rpcq icon indicating copy to clipboard operation
rpcq copied to clipboard

Modify `rpcq:start-server` to support graceful shutdown of worker threads

Open appleby opened this issue 6 years ago • 3 comments

As discussed in the comment thread for PR #74, it's worth investigating whether rcpq:start-server can be modified to support graceful shutdown of worker threads, rather than relying on bt:destory-thread for testing.

The reason for suggesting this change is that just calling bt:destroy-thread was causing test failures on CCL. Those failures were addressed by the changes in #74, but bt:destroy-thread is something of a nuclear option for killing threads, and the bordeaux-threads documentation for destroy-threads warns:

This should be used with caution: it is implementation-defined whether the thread runs cleanup forms or releases its locks first.

So we'd like to do graceful termination of server threads, if possible.

This work might dovetail nicely with the non-blocking start-server changes suggested in #61.

appleby avatar Jun 18 '19 19:06 appleby

See also ecpeterson's comment regarding possibly trickiness of handling the pzmq:device call in rpcq:start-server.

appleby avatar Jun 18 '19 19:06 appleby

Don't forget to cleanup the rpcq tests and replace the calls there to KILL-THREAD-SLOWLY will a graceful shutdown.

See @jmbr's comment here: https://github.com/rigetti/rpcq/pull/113#discussion_r366570677

appleby avatar Jan 14 '20 21:01 appleby

Also don't forget to make the corresponding change to remove KILL-THREAD-SLOWLY in the quilc rpcq tests.

appleby avatar Jan 14 '20 21:01 appleby