]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Fix race condition in the scheduler when deleting a running entry.
authorMark Michelson <mmichelson@digium.com>
Tue, 26 Aug 2014 22:08:39 +0000 (22:08 +0000)
committerMark Michelson <mmichelson@digium.com>
Tue, 26 Aug 2014 22:08:39 +0000 (22:08 +0000)
commit1390b0dbcc9706e7857fcc8715b3f4b6786a5fff
tree9097089b7431d96324996f1a7fce324f4a862432
parentf5451ad4053cf7a0307eb627a3dc1efc04697600
Fix race condition in the scheduler when deleting a running entry.

When scheduled tasks run, they are removed from the heap (or hashtab).
When a scheduled task is deleted, if the task can't be found in the
heap (or hashtab), an assertion is triggered. If DO_CRASH is enabled,
this assertion causes a crash.

The problem is, sometimes it just so happens that someone attempts
to delete a scheduled task at the time that it is running, leading
to a crash. This change corrects the issue by tracking which task
is currently running. If that task is attempted to be deleted,
then we mark the task, and then wait for the task to complete.
This way, we can be sure to coordinate task deletion and memory
freeing.

ASTERISK-24212
Reported by Matt Jordan

Review: https://reviewboard.asterisk.org/r/3927

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@422070 65c4cc65-6c06-0410-ace0-fbb531ad65f3
main/sched.c