cameron314 / cameron314/concurrentqueue
Hang when shutting down blocking concurrent queue via interrupt
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 12.5k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
When attempting to interrupt a blocking concurrent queue that is waiting on a time out, I'm experiencing a hang (until the timeout) in this line
do {
#ifdef MOODYCAMEL_LIGHTWEIGHTSEMAPHORE_MONOTONIC
rc = sem_clockwait(&m_sema, CLOCK_MONOTONIC, &ts);
#else
rc = sem_timedwait(&m_sema, &ts);
#endif
} while (rc == -1 && errno == EINTR);
return rc == 0;
If I change it to respect the interrupt, the timeout doesn't work. However, I'm unable to ctrl-c in my program and shut it down cleanly. What can I do here short of implementing some sort of poll and a smaller timeout?
Also, out of curiosity, is there a benefit to using MOODYCAMEL_LIGHTWEIGHTSEMAPHORE_MONOTONIC?
Contributor guide
No contributing guide indexed for this repository
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
Start at the blocking concurrent queue's semaphore wait path shown in the issue, comparing the sem_clockwait and sem_timedwait branches under MOODYCAMEL_LIGHTWEIGHTSEMAPHORE_MONOTONIC. Determine how an interrupt should affect shutdown without breaking timed waits, and verify the behavior and trade-offs of the monotonic-clock option.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100