Closed wheatman closed 9 months ago
Thanks for the report. We'll look into it.
I haven't yet been able to replicate this failure on my end, but I'm setting up an environment where I might have better luck. We'll keep you posted.
I originally found the issue on a ubuntu server from aws, then created the minimal example on wsl on my laptop, if that helps. I also checked to see if it was becuase I was on 2.0 instead of 2.0.1, but after updating to f54e98722992462e042f0686c74f710277c92cdb the issue was still there.
Also the out of memory crash does not happen every time, about 6 in 1o times, though the race is found every time. Also I tried to make a more minimal version but wasn't able to remove much, its attached if its at all helpful. test.txt
Following-up, I managed to replicate this issue and find a fix for it. I've created a PR with that fix, which I plan to merge once the tests finish running. The fix also seems to fix issue #147.
This issue is fixed in the latest release.
Describe the bug
Races seem to be created in a parallel for loop which is read only to shared data and writes to only local data. The race then causes a out of memory crash
Expected behavior
For the program to not have races
OpenCilk version
clang version 14.0.6 (https://github.com/OpenCilk/opencilk-project fc90ded2b090672f84c58d12d8d85cd999eb6c1a) Target: x86_64-unknown-linux-gnu Thread model: posix
Steps to reproduce (include relevant output)
I found it with the tlx repo which can be cloned from https://github.com/tlx/tlx.git
I found the bug in code which looked like this
When I run this it is killed due to using up all memory, cilk_san shows the following races, but note that std::merge, should be read only to its input iterators (which are also const_iterators) and only write to the local output.
I thought this could have something similar to #147 with the allocation being hoisted so I rewrote the function in the following way so that all allocations happened up front and the issue remained
I am compiling with
~/opencilk/build/bin/clang++ -std=c++20 test.cpp -DCILK=1 -fopencilk -O1 -Itlx/ -g
The issue does not happen if I compile with
-O0