[vbox-dev] Race condition?
maxime.dor at altherian.org
Mon Feb 25 10:36:34 PST 2013
Thank you very much for the insight, that makes it perfectly clear.
I'll make sure this is handled properly then.
Thank you very much for your time.
On 25/02/2013 17:38, Klaus Espenlaub wrote:
> You're not missing anything, and it's not a bug either. It's an
> inherent API race, since there is nothing preventing session state
> changes between the if statement and the unlockMachine() call (and
> there can't be anything preventing it). The cause is that the
> operations you're doing (saveState/powerDown) are terminating the VM,
> and at the very end of those operations the VM session will be taken
> down (which implies that the associated shared session locks are gone
> too). Your API client code is racing with exactly this session cleanup
> which can extend slightly after the operation already signaled
> completion through the corresponding IProgress object. So it's up to
> well-written code to be prepared for such spurious session state
> changes (which might happen for other reasons actually, e.g. if the VM
> process is terminated concurrently by some other API client, which can
> happen even if your code doesn't). Your code has to handle it. Klaus
More information about the vbox-dev