folly icon indicating copy to clipboard operation
folly copied to clipboard

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

Open newpoo opened this issue 2 years ago • 1 comments

An example to demonstrate it:

#include <iostream>
#include <thread>
#include "folly/MPMCQueue.h"

int main() {
    folly::MPMCQueue<int> 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);
}

newpoo avatar Oct 12 '23 05:10 newpoo

Interestingly, this only happens when running inside a Ubuntu20 docker on a Mac. It runs as expected in a native Ubuntu20 VM on AWS.

newpoo avatar Oct 12 '23 21:10 newpoo