PRX / feeder.prx.org

Dovetail podcast content management system
https://podcasts.dovetail.prx.org
GNU Affero General Public License v3.0
5 stars 0 forks source link

Delegated Delivery, race between the publishing routine and the Episode#publish! init method #1022

Open svevang opened 2 months ago

svevang commented 2 months ago

Episode#publish! and Podcast#publish! are assumed to be idempotent, however there is a race in the initialization routine Episode#publish! and the delegated delivery publishing machinery.

1) The call to Episode#publish! happens outside the publishing lock. This call prepares the episode for re-upload by soft deleting the Apple::Delivery instances associated with this episode. This is needed because a new delivery instance is needed for each upload process.

2) The delegated delivery process depends on the Apple::PodcastDelivery instance, e.g. in the case where we are polling for delivery state.

What can happen is that the episode is published and a publishing pipeline begins and then is quickly edited again, this in turn causes a soft deleting the podcast delivery instances (as legacy of treating them as sentinels), which causes related models to blow up when they follow their object hierarchy.