On 05/27/2010 04:35 AM, Gordon Sim wrote:
I've been trying to debug this issue a little, and am looking for some
information (from Steve and Andrew in particular).
One issue appears to be that the IO threads are terminated by the c++
runtime *before* the IOThread destructor is called. This termination is
abrupt and they do not get a chance to finish processing any outstanding
completions (meaning they never call the close callback on the dispatch
handle which prevents the Connector+ConnectionImpl code from cleaning
itself up correctly).
I would have expected that all destructors for global and static objects
would be called before terminating threads. Does anyone have any insight
into the way this works on windows? Is the fact that the IOThread static
is in a dynamic library relevant here?
I don't know if the standard guarantees to run static dtors before terminating
threads. IMO this re-emphasizes the need for a required global init/shutdown
called by the user in main() so we can do all cleanup before dropping off main
and getting into murky waters. In my past experience this was the only
successful and portable way to avoid shutdown hangs and cores.
IMO it's very important to introduce this with the new API even if its only a
dummy implementation initially, and *require* its use by throwing exceptions if
qpid is used un-initialized.
However that doesn't provide a backward compatible solution for the old API. If
we cant get it working with global dtors I suggest we provide a shutdown call
for the old API so that users can at least work around the problem.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]