[ace-users] ACE_TP_Reactor cancel_timer and handle_timeout
nicolen at gmail.com
Thu May 21 06:00:09 CDT 2015
In my project, we maintain a variable to keep track of whether the timer is
actually running before attempting to cancel that timer. If cancel timer
fails after that check, we assume it's already been in the event queue to
be processed next.
On Thursday, May 21, 2015 at 8:55:47 AM UTC+1, joris.... at esaturnus.com
> ACE 6.0.3 running on 32 bits debian wheezy.
> We are using an ACE_TP_Reactor with one thread, we notice that it is
> possible for a timer to still be called after cancel_timer has been called.
> This is the sequence of events leading up to it:
> - A notify event causes the reactor to call one of our event handlers
> - The event handler cancels a timer, and invalidates an object which will
> be used in the handle_timeout code of the timer.
> - The event handler does a synchronous outbound CORBA call.
> - During the handling of the CORBA call, the reactor runs again, and calls
> handle_timeout for the timer we just canceled.
> - In the handle_timeout, we attempt to access the object which got
> invalidated just after the cancel_timer. And then we crash.
> We can fix this crash easily in our code, but the question here is, is
> this valid behavior of the ACE_TP_Reactor ?
> What happens when a timer has expired and is ready to be executed, but
> another event handler is called first, and cancels this timer ?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ace-users