facebook / facebook/folly

MPMCQueue blockingRead() doesn't return even with a subsequent write()

Open
#2,080 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
30.5k
Forks
5.9k
PR merge metrics
No merged PRs in 30d

Description

An example to demonstrate it:

```
#include
#include
#include "folly/MPMCQueue.h"

int main() {
folly::MPMCQueue q(1024);
std::thread t([&q](){
int i;
std::cout << q.size() << std::endl;
q.blockingRead(i); // never wake up
std::cout << q.size() << std::endl;
std::cout << i << std::endl;
});

sleep(1);
std::cout << q.size() << std::endl;
q.write(333);
std::cout << q.size() << std::endl;
while(true);
}
```

Contributor guide

Open the contributing guide

Research direction

Start by running the reproducer in the issue and reading folly/MPMCQueue.h, focusing on blockingRead() and the write() path that should wake it. Done means a waiting blockingRead() returns after write(333) and receives 333; add or update a focused regression test if the repository provides a suitable queue test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.