blocked in message_queue::timed_receive
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- operating-systems
Research direction
Start by reproducing the reported message_queue::timed_receive call with the 100-millisecond timeout, then inspect boost/interprocess/sync/detail/common_algorithms.hpp where try_based_lock spins while m.try_lock() returns false. Trace the lock ownership and timeout path; done means the reported call returns rather than remaining blocked.
Written by the indexing model from the issue text.
Description
I'm using boost_1_89_0 & boost::interprocess::message_queue for inter-process communication. The receiver calls timed_receive to receive messages with a timeout set to 100 milliseconds. It works correctly most of the time, but occasionally it gets blocked, meaning timed_receive does not return.
boost::interprocess::message_queue *msg_queue;
// ...
boost::posix_time::ptime timeout = boost::posix_time::microsec_clock::universal_time() + boost::posix_time::milliseconds(100);
bool ret = msg_queue->timed_receive(buf, 8192, recvd_size, priority, timeout);
I checked the call stack, and it is blocked at the following location:
boost\interprocess\sync\detail\common_algorithms.hpp
template<class MutexType>
void try_based_lock(MutexType &m)
{boost::interprocess::message_queue
if(!m.try_lock()){
spin_wait swait;
do{
if(m.try_lock()){
break;
}
else{
swait.yield();
}
}
while(1);
}
}
I stepped through the code and found that m.try_lock() keeps returning false.
Thanks.
- Dominant language
- C++
- Stars
- 185
- Forks
- 131
- PR merge metrics
- No merged PRs in 30d
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.
More from boostorg/interprocess
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
boostorg/interprocess#196 · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
boostorg/interprocess#279 ·
-
Difficulty 5/5 Over a week Newbie friendliness 28/100
boostorg/interprocess#268 · 4 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
boostorg/interprocess#262 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 32/100
boostorg/interprocess#253 ·
All issues in boostorg/interprocess
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
objectionary/eo-graphs#74 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 88/100
QuantStack/git2cpp#187 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100