rstudio / httpuv

HTTP and WebSocket server package for R
Other
224 stars 84 forks source link

Fix race condition between `Barrier` destructor and `Barrier.wait()` #352

Closed wch closed 1 year ago

wch commented 1 year ago

Closes #351. This eliminates the race condition between the Barrier destructor and a call to Barrier.wait().

Test code:

for i in {1..16}; do
    yes > /dev/null &
done

for i in {1..50}; do
    Rscript -e "s <- httpuv::startServer('0.0.0.0', 8000, list()); cat('.')"
done

killall yes

If everything works, it'll just print out a bunch of dots, like .........

If there's a crash, it'll print out Abort trap: 6.

jeroen commented 1 year ago

Looks good: https://github.com/jeroen/httpuvtest/actions/runs/3891061945/jobs/6641550474