Code review comment for lp:~vila/bzr/405745-http-hangs

Revision history for this message
Vincent Ladeuil (vila) wrote :

Thanks to Cris Boylan that keep nagging me on the problem, this patch
addresses the http tests hanging on AIX.

The crux of the issue is that shutdown() can be implemented differently on various systems
and we were trying to handle the socket from two different threads, which is frowned upon on AIX.

This patch stops the server more "manually" but more importantly more cleanly by
connecting to the server (allowing it to wake up from the listen() call and terminate
cleanly).

The server thread can now be joined without trouble reducing the leaking tests from ~300 to ~200
(when running bzr selftest -s bt.test_http).

Note that I didn't add any test here.
I tried to modify test_http.TestHTTPServer.test_server_start_and_stop to check
that no threads were leaked, but that just pointed out that the threading functions
active_count() and enumerate() are very happy to disagree about the number of active threads
even when called one after the other (I can't demonstrate it but I experimented it in ~5-10%
of my test runs).

Other submissions will follow shortly to address more leaks (first http/1.1, then ftp).

« Back to merge proposal