You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix crash at exit due to a race condition with new signal handler
Previously, the signal handler would interrupt the main thread (thread
that calls `Server::Run`), so there was no chance for the main thread to
resume before the signal handler was finished. With the new signal
handler implementation in gz::common, the signal handler is now called
from a different thread which means the main thread might resume before
the signal handler is finished. This causes a race condition in which
the `Server` class, and therefore the `ServerPrivate` class are being
destructed while the signal handler is still active. Since
`ServerPrivate` also contains the class that encapsulates the signal
handler implementation, the causes a crash as the signal handler tries
to access data that has been deleted.
The fix here is to ensure that the main thread does not exit until the
signal handler is finished by synchronizing on a mutex.
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
0 commit comments