The cross test suite kills the server process after the client is done, see test/crosstest/run.py:_scoped, the process is killed. This means that we don't ever test teardown in any language in our cross tests. Further, in some servers like the C++ TestServer, code at the end of main it sits in a TIGHT while loop unnecessarily causing CPU usage and slowing down the system.
There should be a signal (like SIGINT) that each server waits for, and on receiving that signal stops the thrift server cleanly. This ensures we properly test teardown.
There is a new property in the tests.json file under server called "stop_signal". If defined, the server understands how to stop when given this signal. The cross test suite honors this. Currently the cpp, d, and perl servers handle it properly.
When a server handles this signal, if the server dies unexpectedly or fails to stop that is considered an error. The old behavior is applied to any legacy server which doesn't understand how to use a signal to stop. In that case the server is killed with SIGKILL (unconditionally) and any result is ignored.
All test servers should be updated to support this new mechanism as soon as possible so that we improve test coverage of server stop / teardown code.