Comment 11 for bug 193253

Revision history for this message
Vincent Ladeuil (vila) wrote : Re: [Bug 193253] Re: sockets being leaked in branch puller tests

>>>>> "Jonathan" == Jonathan Lange <email address hidden> writes:

    Jonathan> Hi Stuart,

    Jonathan> I've just had a look at this. The client side of
    Jonathan> the connection is established by Branch.open in
    Jonathan> assertMirrored. Bazaar doesn't provide an API for
    Jonathan> closing this connection.

    Jonathan> Given that Bazaar's behaviour is correct and that
    Jonathan> the test is using it sanely, I can think of three
    Jonathan> options:

    Jonathan> - Fiddle with the Bazaar internals

    Jonathan> - Run the test HTTP server in a subprocess and kill
    Jonathan> it when we are done

    Jonathan> - Change the socket-leaking check

    Jonathan> I'm leaning towards the third option. Like I said,
    Jonathan> Bazaar is working fine and we are using their API
    Jonathan> correctly, so it feels a bit backwards to have to
    Jonathan> "fix" it.

    Jonathan> Thoughts?

Memory kind of coming back, when I rewrote the HTTP server code,
at one point, I implemented a way to force the connection closing
on the *server* side.

I didn't continue in that direction because:

1) Tracking HTTP connections was a bit ugly,

2) Waiting for the server thread slowed down the test suite
   significantly.

One reason for the server rewrite was indeed to fix all the
leaking sockets and AFAIK there are no more leaks anymore (at
least all the open sockets get gc'ed cleanly at some point) and
allowed the bzr test suite to run on OS X again (which was one of
the initial bugs).