cmusatyalab / opendiamond

Interactive search of non-indexed data
http://diamond.cs.cmu.edu/
Eclipse Public License 1.0
19 stars 9 forks source link

Server can deadlock on signals #28

Open bgilbert opened 11 years ago

bgilbert commented 11 years ago

diamondd raises an asynchronous exception when it receives a signal. However, the Python standard library is not async-exception safe. In particular, logging can fail to release its lock; we then try to log that we are exiting, and deadlock.

Worker threads use SIGUSR1 to report failures to the main thread, so this can be triggered by startup errors. Reproducer: configure an invalid Redis server, then run a search.

We need to initiate shutdown in a different way, such as by closing sockets.