When running the following bufferstress.ml
program testing Buffer
in the bytecode debug runtime (tried it on amd64 5.0.0, but also amd64 trunk (updated the 9th of March), and amd64 5.0.0 32-bit only) I get an assertion failed:
$ ocamlc -g -o bufferstress.bc bufferstress.ml
$ ocamlrund bufferstress.bc
### OCaml runtime: debug mode ###
[00] file runtime/str.c; line 44 ### Assertion failed: Byte (s, temp - Byte (s, temp)) == 0
The code is mischievous because it uses Buffer
without synchronization, but still…
let buf = Buffer.create 8
let tester () =
Buffer.reset buf;
Buffer.add_string buf "aaaaaa";
let wait = Atomic.make true in
let dom1 =
Domain.spawn (fun () ->
while Atomic.get wait do Domain.cpu_relax () done;
Buffer.clear buf)
in
let dom2 =
Domain.spawn (fun () ->
Atomic.set wait false;
Buffer.add_string buf "aaaa")
in
Domain.join dom1;
Domain.join dom2
let _ =
for _i = 0 to 1000 do
tester ()
done
(Context: I ran into this failure trying to reproduce and simplify a Buffer
test in our multicoretests suite because we’ve observed a (reproducible) segfault in a 5.0.0 32-bit bytecode run: tracking issue)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4