[Ace-users] [ace-users] Race condition between handle_input() & handle_timeout() in ACE_Svc_Handler ?

robert.ciora at us.transport.bombardier.com robert.ciora at us.transport.bombardier.com
Mon Nov 19 07:43:18 CST 2007

My suspicion is that when the handler is destroyed, it's not being 
unregistered from *all* events that it was registered for (e.g. timeouts, 
reads, writes).  From my experience, this is the primary cause for this 
type of crash.  Have you ensured that on its destruction path, the Handler 
has cancelled all timers and unregistered from the Reactor with an 
ALL_EVENTS_MASK?  Also, make sure that the underlying socket (peer) hasn't 
been destroyed yet (or at least make sure that you've saved the socket's 
handle somewhere), since the Reactor requires that socket's handle (via 
the get_handle() on the Handler, which calls get_handle() on the peer). If 
the socket is destroyed before the Handler tries to unregister, the 
socket's handle will be invalid and this will not allow the Reactor to 
properly map handle to Handler for unregistering.  In this case as well, 
your Handler will still be registered with the Reactor even after it's 
been destroyed.

"Douglas C. Schmidt" <schmidt at dre.vanderbilt.edu>
Sent by: ace-users-bounces at cse.wustl.edu
11/19/2007 08:25 AM

ace-users at cse.wustl.edu

Re: [ace-users] Race condition between handle_input() & handle_timeout() 
in ACE_Svc_Handler ?

Hi Shawn,

>I have synchronized the handler methods with a thread mutex. But my
>problem is if I return -1 in the handle_timeout, other thread might
>crash and seems it's using the handler.
>And I also tried to use notify and return -1 inside handle_exception()
>but no luck.
>It seems that even I returned -1 in handler methods, and the handler
>is released, ACE is still trying to distribute events to that
>*destroyed* handler.
>Is this a know bug in ACE5.4 or mis-use of "return -1' ?

Good question.  I recommend you first try to upgrade to ACE 5.6.1
<download.dre.vanderbilt.edu> and if that doesn't help we'll think of
something new.



ace-users mailing list
ace-users at mail.cse.wustl.edu


This e-mail communication (and any attachment/s) may contain confidential 
or privileged information and is intended only for the individual(s) or 
entity named above and to others who have been specifically authorized to 
receive it. If you are not the intended recipient, please do not read, 
copy, use or disclose the contents of this communication to others. Please 
notify the sender that you have received this e-mail in error by reply 
e-mail, and delete the e-mail subsequently. Please note that in order to 
protect the security of our information systems an AntiSPAM solution is in 
use and will browse through incoming emails. 
Thank you. 

Ce message (ainsi que le(s) fichier(s)), transmis par courriel, peut 
contenir des renseignements confidentiels ou protégés et est destiné à 
l?usage exclusif du destinataire ci-dessus. Toute autre personne est, par 
les présentes, avisée qu?il est strictement interdit de le diffuser, le 
distribuer ou le reproduire. Si vous l?avez reçu par inadvertance, 
veuillez nous en aviser et détruire ce message. Veuillez prendre note 
qu'une solution antipollupostage (AntiSPAM) est utilisée afin d'assurer la 
sécurité de nos systèmes d'information et qu'elle furètera les courriels 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/ace-users/attachments/20071119/a611e3ea/attachment-0001.html 

More information about the Ace-users mailing list