-
Notifications
You must be signed in to change notification settings - Fork 253
Description
Describe the bug
On POSIX systems using the Binary Semaphore API, there is a risk that threads can become deadlocked after deleting a task that was executing an OS_BinSemTake() API call.
To Reproduce
- Create two tasks and one binary semaphore.
- Task A calls
OS_BinSemGive()at some event/interval. - Task B waits on the binary sem using
OS_BinSemTake()
Then delete task B while it was pending in OS_BinSemTake().
The semaphore resource is now inoperable, because the condition mutex was "owned" by task B at the time it was deleted, and is never released, thereby preventing any other task from using the mutex.
Expected behavior
The semaphore should continue to be usable by other tasks after deleting task B.
System observed on:
Ubuntu 20.04
Additional context
This was originally reported/observed in nasa/cFE#701, during shutdown where timers were used.
Reporter Info
Joseph Hickey, Vantage Systems, Inc.
(After diagnosis/investigation of issue reported by @excaliburtb in above ticket)