SNAS / openbmp

OpenBMP Server Collector
www.openbmp.org
Eclipse Public License 1.0
232 stars 76 forks source link

Race condition and crash when killed during router disconnect #54

Closed alistairking closed 7 years ago

alistairking commented 7 years ago

It seems that if the collector is killed (SIGINT) while it is in the process of cleaning up after a router disconnect, then something goes wrong with the thread and I see the following message:

^C2017-10-12T23:57:41.037796 | NOTICE   | signal_handler     | Caught signal 2
terminate called without an active exception
Aborted (core dumped)

From what I can tell this is probably something like the main thread trying to cancel the client thread while it is already in the process of shutting down. I took a quick look, but nothing obvious stood out.

I'm able to fairly easily reproduce this by using the openbmp-forwarder to send messages to the collector. I then kill the forwarder and immediately kill the collector. If I wait until the collector has finished cleaning up after the client disconnect, then it will shut down cleanly.

TimEvens commented 7 years ago

Nice. :). That’s a problem with catching the signals. I’ll reproduce with a ST, but I suspect it’s related to closing/freeing the resources.