Tags: cloudfoundry/garden
Tags
fix race in Run with quickly-exiting jobs Previously this was just Spawn + Link; this had the following race: -> Spawn -> Wait for ready -> Link asynchronously -> Wait for active -> Job exits -> Job is unregistered -> Link -> Job is not registered! This change makes it so that a backend can be told not to auto-link when spawning a job. This fixes the above race and turns it into this: -> Spawn -> Wait for ready -> Link -> Job exits -> Job is unregistered Note that this doesn't currently wait for the "active" message from the spawn after the later link. Unsure how important that is. Also note that, while this functionality to "wait for a link" technically exists in Spawn, it may not be the best idea to expose it through the API, as that would mean someone can set up a Spawn but then never link (say the calling process dies). I don't think that intermediate state is good to expose, and instead there should be things like Run (Spawn+Link) and a Spawn+Stream equivalent. These exist to remove the race condition while guaranteeing that the job executes. [finishes #62940264]