Debugger: cleanup server-side when the client disconnects while in run mode
commit05871951f0ba18c5e06399f30a66c1fa7733719c
authorMike Magruder <mikemag@fb.com>
Thu, 18 Jul 2013 23:52:36 +0000 (18 16:52 -0700)
committerSara Golemon <sgolemon@fb.com>
Fri, 26 Jul 2013 18:31:16 +0000 (26 11:31 -0700)
treeab14904ab6460d41577940af1e74ae2873d5f471
parenta9e05eabf47817071b2bca5e106fec12891ca46f
Debugger: cleanup server-side when the client disconnects while in run mode

Server-side cleanup was all driven by having a request thread see that either the connection with the client is closed, or the stopped flag on the proxy is set. However, if a debugger's in the run state and there's just no incoming requests against the right sandbox, then that would never happen. However, the signal polling thread is perfect to notice, there were just issues coordinating the cleanup of the proxy.

Modified stop() on the proxy to be callable from any thread, and to initiate cleanup of the proxy but pass the final cleanup off to another thread which can complete it. The signal polling and dummy sandbox threads are owned by the proxy, so they can't complete the work themselves. There was logic to queue cleanup just for the dummy sandbox, so I turned that into proxy cleanup and have it cleanup both.

I'll investigate making a unit test using the new framework that will test this, but that will come in a later diff since this diff is already quite involved.
hphp/doc/debugger.devdocs
hphp/runtime/base/types.h
hphp/runtime/debugger/debugger.cpp
hphp/runtime/debugger/debugger.h
hphp/runtime/debugger/debugger_proxy.cpp
hphp/runtime/debugger/debugger_proxy.h
hphp/runtime/debugger/debugger_server.cpp
hphp/runtime/debugger/dummy_sandbox.cpp
hphp/runtime/debugger/dummy_sandbox.h