We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2870 - Deadlock in SDL SIGINT and SIGTERM handling
Summary: Deadlock in SDL SIGINT and SIGTERM handling
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 2.0.3
Hardware: x86_64 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-07 10:20 UTC by Magnus Bjerke Vik
Modified: 2015-06-08 05:53 UTC (History)
1 user (show)

See Also:


Attachments
Backtrace for deadlock (1.21 KB, text/plain)
2015-02-07 10:20 UTC, Magnus Bjerke Vik
Details
Code to reproduce deadlock (495 bytes, text/plain)
2015-02-07 10:24 UTC, Magnus Bjerke Vik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Bjerke Vik 2015-02-07 10:20:26 UTC
Created attachment 2023 [details]
Backtrace for deadlock

Receiving a SIGINT or SIGTERM while already inside malloc routines will cause the program to deadlock.

I've attached a backtrace from a case where the signal is received while freeing some allocated data.

I've also attached a simple program to reproduce the problem. It might have to be run a few times to ensure that the signal is received while in a malloc routine.

I've only tested this on Linux, yet. A simple workaround is to handle the signals yourself and avoid any malloc routines.
Comment 1 Magnus Bjerke Vik 2015-02-07 10:24:13 UTC
Created attachment 2024 [details]
Code to reproduce deadlock

You might have to run the program a few times so that the signal is received while in a malloc routine. You can also increase the numAllocs.
Comment 2 Ryan C. Gordon 2015-06-08 05:53:49 UTC
This is fixed now in https://hg.libsdl.org/SDL/rev/fd60d77139fc, thanks!

--ryan.