Fix quitting legacy debugger with ^C (without coredump)
commitfa7c6c071d47d0d0a3fc56aa1d575a4e0895cd77
authorAlexey Toptygin <alexeyt@fb.com>
Thu, 18 Aug 2022 23:42:31 +0000 (18 16:42 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Thu, 18 Aug 2022 23:42:31 +0000 (18 16:42 -0700)
tree8a78906beef7be8219947d961a69e0c87ea63792
parent33224ae66a9fd74c97ee49099bdad40084918df9
Fix quitting legacy debugger with ^C (without coredump)

Summary:
Make DebuggerThriftBuffer::close close the SocketData m_socket without trying to allocate heap memory for a Socket; this (plus the RDS_LOCAL removal in the stack below) makes it work in a signal handler context.

Make the legacy debugger's signal handler stop throwing exceptions, instead just closing all connections and setting the m_stopped bit. Also make the client run loop check the m_stopped bit when the connection to the server has gone away (instead of blindly trying to reconnect) and if it's true have it exit the client run loop by throwing DebuggerClientExitException (on the appropriate thread this time).

Finally, make the legacy debugger's signal handler unregister itself if it's shutting down the debugger, so that a further ^C can be handled by the kernel (and kill the script being debugged if it's still trying to run).

Reviewed By: ricklavoie

Differential Revision: D38837098

fbshipit-source-id: a92e9eff9850dfc413c7a9953fdb570de51d23b4
hphp/runtime/debugger/debugger_client.cpp
hphp/runtime/debugger/debugger_thrift_buffer.h