[ace-users] ACE_TP_Reactor:random crash sometimes

Steve Huston shuston at riverace.com
Tue Jun 12 06:04:40 CDT 2007


Hi Mihai,

It could be that the reactor is still dispatching notifications after
the handler is unregistered. You can investigate two ways to avoid
this:

1. See sidebar 22 on page 94 in C++NPv2
2. Use event handler reference counting to avoid deleting a handler
while there's a reference pending (the notify). See ACE News and Tips
Newsletter from October 2005
(http://www.riverace.com/newsletters/October2005.htm)

Best regards,
-Steve

--
Steve Huston, Riverace Corporation
Would you like ACE to run great on your platform?
See http://www.riverace.com/sponsor.htm


> -----Original Message-----
> From: ace-users-bounces at cse.wustl.edu 
> [mailto:ace-users-bounces at cse.wustl.edu] On Behalf Of Mihai Bucica
> Sent: Tuesday, June 12, 2007 6:17 AM
> To: ace-users at cse.wustl.edu
> Subject: Re: [ace-users] ACE_TP_Reactor:random crash sometimes
> 
> 
> 
> --- "Douglas C. Schmidt" <schmidt at dre.vanderbilt.edu>
> wrote:
> > >     ACE VERSION: 5.5
> > 
> > ACE 5.5 is rather old, so could you please try
> > upgrading to ACE+TAO+CIAO
> 
> 
> I've compiled it the latest beta kit ACE 5.5.8 and the
> issue is valid.
> 
> PRF:
> 
>     ACE_TP_Reactor:random crash sometimes 
> 
>     ACE VERSION: 5.5.8 (latest beta kit)
> 
>     HOST MACHINE and OPERATING SYSTEM:
>       AMD Turion 64 & Windows XP Pro 32
> 
>     COMPILER NAME AND VERSION (AND PATCHLEVEL):
>       Microsoft Visual C++ .NET 2003
> 
>     THE $ACE_ROOT/ace/config.h FILE : 
>       #include "ace/config-win32.h"
> 
>     AREA/CLASS/EXAMPLE AFFECTED:
>       ACE_TP_Reactor & Acceptor
>  
>     DOES THE PROBLEM AFFECT:
>       EXECUTION
>       
>     SYNOPSIS:
>       sometimes one thread from ACE_TP_Reactor' pool
> is trying to access a recently removed handle 
>     
>     DESCRIPTION:
>       I'm trying to build a server starting from
> examples/APG/TreadPools/TP_Reactor project and I've
> performed the following small modifications:
>       I've added a 'ACE_Reactor_Notification_Strategy
> _notifier' to our Request_Handler class and also done
> the proper initialization stuff:
>       
>       Request_Handler: notifier_ (0, this,
> ACE_Event_Handler::WRITE_MASK)
>       Request_Handler::open -> this->notifier_.reactor
> (this->reactor ());
>                                this->msg_queue
> ()->notification_strategy (&this->notifier_);   
>    
>       I'm also doing a strange thing in handle_input()
> 
>       int Request_Handler::handle_input() {
>         ..............
>         ACE_Message_Block *mb = new
> ACE_Message_Block(sizeof(buffer)+1);
>         mb->copy(buffer,sizeof(buffer));
>         this->putq(mb); 
>   
>         return -1; 
>       }
>       
>       int Request_Handler::handle_close (ACE_HANDLE
> fd, ACE_Reactor_Mask)
>       {
>         ACE_DEBUG ((LM_DEBUG,
>               ACE_TEXT ("(%t) svr close; fd: 0x%x\n"),
>               fd));
> 
>         return super::handle_close();
>       }
> 
>       This will cause the program to crash
> sometimes.The 'handle' is removed from reactor and
> deleted but another thread from the thread pool will
> try to output our ACE_Message_Block object from the
> event handler internal queue.   
>       (5200) handling events ....
>       (3672) handling events ....
>       (5676) handling events ....
>         Request_Handler::open
>       (3672) handling events ....
>       (5676) handling events ....
>       (5200) handling events ....
>       (3672) svr input; fd: 0x6d8; input: e
>       (3672) svr close; fd: 0x6d8
>       (3672) ~Request_Handler()
>       (3672) handling events ....
>       (5200) handling events .... !!! HERE IT CRASHES
> because the thread 5200 is trying to access the
> previous deleted Request_Handler() object because he
> tries to output our ACE_Message_Block object from the
> event handler internal queue !!!!
>       
>       
> 
> 
> 
>  
> ______________________________________________________________
> ______________________
> Never miss an email again!
> Yahoo! Toolbar alerts you the instant new Mail arrives.
> http://tools.search.yahoo.com/toolbar/features/mail/
> 
> _______________________________________________
> ace-users mailing list
> ace-users at mail.cse.wustl.edu
> http://mail.cse.wustl.edu/mailman/listinfo/ace-users
> 




More information about the Ace-users mailing list