project-chip / project-chip/connectedhomeip
[BUG] Linux signal handler allocates memory (sometimes)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 9k
- Forks
- 2.5k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 314
Description
Reproduction steps
https://csamembers.slack.com/archives/G014G30SVV0/p1692672808611959
If you hit it just right, the signal handler tries to post an event to a queue that's full, the queue grows and the entire app blows up with complaints about allocating memory in a signal handler.
Problem is in examples/platform/linux/AppMain.cpp, StopSignalHandler function. The calls to GenerateShutdownEvent and ScheduleWork both cause this problem and should be moved out of the signal handler code.
Bug prevalence
rarely, but the script from the linked slack convo above is 100%
GitHub hash of the SDK that was being used
378969c9266d5eb9a0bab30b0864f633ba4ed27f
Platform
other
Platform Version(s)
all linux
Anything else?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read examples/platform/linux/AppMain.cpp, focusing on StopSignalHandler and the GenerateShutdownEvent and ScheduleWork calls. Reproduce the linked Slack scenario if available, then verify that the signal handler no longer performs the problematic queue operations while shutdown behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, linux
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100