snikulov's picture

Hi,

I've hit with the issue related to WebService plug in termination

The symptoms as follows:

1. pion::net::WebServer started and plug in serves long write() request
2. terminate WebServer with Ctrl+C
3. Exception pion::net::HTTPWriter::LostConnectionException thrown and abnormal termination with folowing message
"terminate called after throwing an instance of 'pion::net::HTTPWriter::LostConnectionException'
what(): Lost TCP connection while or before sending an HTTP message"

The question is follows - Is any right way to terminate the WebService plugin available?
What should I do to correctly stop the long asynchronous write operation to get rid of such exception?

Mike Dickey's picture
Fixed in SVN

I just checked-in patches to resolve this problem in subversion. Note that I had to patch all three repos (pion-common, pion-net, pion-platform). Please see the trac ticket for details. This will be included in the next (1.0.6) release.

Submitted by Mike Dickey on Fri, 11/07/2008 - 15:49.
snikulov's picture
Thank you. Will test it soon

Thank you.
Will test it soon :-)

Submitted by snikulov on Wed, 11/12/2008 - 21:18.
Mike Dickey's picture
I believe it's a bug

We recently fixed something similar in pion-platform's ReactionScheduler (a derived class from pion::PionScheduler). Basically, the LostConnectionException is not getting caught by the PionScheduler thread that is used to handle the web requests & async sending in HTTPResponseSender.

I added a ticket to fix this in the next release iteration -- it should be very easy. Basically, instead of the thread starting with the io_service::run() call, it should boost::bind to a local member function that calls io_service::run() inside a try/catch block, and logs exceptions rather than blowing up..

For example, see processServiceWork() and processReactionQueue() in ReactionScheduler.hpp:

http://pion.org/files/pion-platform/platform/doc/html/_reaction_schedule...

Here's the new ticket in trac:

http://trac.atomiclabs.com/ticket/346

Submitted by Mike Dickey on Fri, 10/17/2008 - 16:05.