ACE VERSION: 5.5<br><br> HOST MACHINE and OPERATING SYSTEM: RedHat ES 3, gcc-4.1.1<br> ACE_HAS_NOTIFICATION_QUEUE is defined<br><br> AREA/CLASS/EXAMPLE AFFECTED: ACE_TP_Reactor<br><br> DOES THE PROBLEM AFFECT:
<br> EXECUTION? Yes<br><br> SYNOPSIS: Event_Handler suspension not honored for handle_close<br><br> DESCRIPTION:<br>handle_close on an event handler is getting called by two threads in the same thread pool using the same ACE_TP_Reactor. One call is from a -1 return from an the default handle_exception event (which was triggered earlier via reactor->notify) and the other is a -1 return from a handle_input.
<br><br>The problem is intermittent and doesn't happen every time.<br><br>The sequence of events is this<br><br>handle_close is called with mask of 4 (but doesn't exit)<br>handle_close is called again by another thread with mask of 1
<br>handle_close with mask of 1 exits<br>segfault before handle_close with mask of 4 exits.<br>The stack trace is usually corrupted, but sometimes reports reactor->remove_handler()<br><br>handle_close does call remove_handler, purge_pending_notifications and all of the usual, with ALL_EVENTS_MASK | DONT_CALL and then super::handle_close(). ACE_Svc_Handler::handle_close I believe calls delete on the object, which is good. The bad thing is, there is a another thread using that object that shouldn't be.
<br><br>The threads calling handle_close are the correct threads that are associated with that thread pool. They're not doing anything fancy, just calling handle_events.<br><br>As I understand it, the ACE_TP_Reactor is supposed to suspend events on an event handler that is being called by another thread until that call returns. So what's going on here? Is this a mistaken interpretation by me? Is there a known bug in this version? Or is something else entirely going on?
<br><br> REPEAT BY:<br> Happens intermittently. Call reactor->notify(event_handler).<br><br> SAMPLE FIX/WORKAROUND: Haven't found one<br><br>