[ace-users] Acceptor pattern w/ select reactor notification crash...

Mark Steele msteele at magpieti.com
Fri Sep 28 10:17:15 CDT 2007

ACE 5.5.8
Fedora core 5 linux
Acceptor  pattern
Selector reactor
Notification strategy

I am getting quite a few segmentation faults that appear in the 
following manner.

A client connects to the acceptor and begins sending and receiving messages.
After some point the client disconnects - either expected (logoff) or 
unexpected (dropped network).
I catch the SIGPIPE signal and enqueue a HANGUP message as follows:
    a) Note the current notification strategy
    b) NULL the notification strategy
    c) Construct an ACE_Message_Block with length 0 and message type set 
    d) Put above message on message queue.
    e) If cached notification strategy from step a is not NULL then call 
notify on it.
    f) Return 0

I run the app and see that someone is putting a message on my  message 
queue and triggering
my notification strategy to push my object back on the reactors 
notification pipe. Then when
I'm reading my message_queue in handle_output I find the message with 
the message type of
MB_HANGUP and return -1 (which is my understanding will call 
handle_close which in turn
deletes the object). Then the reactor notification pipe attempts to call 
this object to handle_output
again and crashes since the object has been freed inside the 
handle_close method.

So, the question is what is the correct way to close an ACE_Svc_Handler 
when a SIGPIPE occurs?


More information about the Ace-users mailing list