Boost logo

Boost :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2008-01-04 08:36:43


First I have to apologize for cross - posting,
but I really do not know which is the correct list
to ask this.

This is a follow up to my first attempt that was of
subject "Stopping active open connections".

I know it would be ideal if I was able to post a code
snippet that clearly shows the bug I suspect. But
unfortunately I am not able to do so. The "bug" seems
to be so time dependent, that I cannot manage to
isolate it from my code.

Instead I submit a reasoning and a fix that worked
in my case. I am doing this in the hope that someone
(chris possibly you ? ) can assert it really is a bug
or give me a hint what I might do wrong.

1) What is happening:
    In code similar to the http server3 example I have
    one client connection open (waiting for a read)
    and one pending incoming connection.

    Shuting down the server (Ctrl-C) shows inconsistent
    behaviour:
    *) Either everything works well or
    *) the open connection socket gets closed, but the
       connection objects dtor does not get called or
    *) there is an access violation, with odd stack
       frame (somewhere from biolsp.dll ?!)

2) What change made it work for me?
    In the file win_iocp_io_service.hpp on line 94 in
    function shutdown_service I changed the timeout value
    from zero to 10 msec.

To me the problem looks as if it was not possible to
reliably find out the number of outstanding operations.
Since 10 msec is as arbitrary a number as 0 I guess
the proposed change is not a solution but only masking
the error in a different manner.

This would mean that it would be necessary to record
the outstanding operations in a separate list and
call the destructors on all that have not been retrieved
by GetQueuedCompletionStatus.

In the hope that someone cares,

Roland aka speedsnail


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk