Deadlock when cancelling coros
Laurent
laurent.aml at gmail.com
Fri May 6 18:58:21 CEST 2011
On Fri, May 6, 2011 at 2:39 AM, Marc Lehmann <schmorp at schmorp.de> wrote:
> On Thu, May 05, 2011 at 06:53:59PM -0400, Laurent <laurent.aml at gmail.com> wrote:
>> I have the following deadlock issue with Coro...
>
> Thats simply a bug in your code - after you cancel a coro, you cannot switch
> to it anymore - it has been canceled.
The issue is that the DESTROY/guard code trying to use events/condvar
does not always know whether it will be called from a coro under
cancellation or from an active coro.
In my real case, the object under destruction only relied on AnyEvent,
not even knowing it was used in a Coro-based program.
So basically, you suggest to not use AnyEvent or coro-aware blocking
calls (condvar/sleep/unblocked IO/...) within destructors/guards when
we intend to use coro cancellation.
This is quite a behavior that may deserve a note in the doc, maybe.
Could this kind of deadlock be automatically detected?
This situation is not completely trivial to troubleshoot...
Thanks,
-- Laurent
More information about the anyevent
mailing list