-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A memory allocation race in lx is causing nondeterministic crashes #351
Comments
Running this in a loop: $ while true; do sleep 0.1; ./build/bin/lx -l test < src/lx/lexer.lx \ && echo ok; done Produces a stream of intermittent failures. There appears to be unsynchronized access to a shared/global resource, and races on either `realloc`ing or `free`ing it can nondeterministically lead to memory corruption. For now, change to using only one thread -- issue #351 exists as a reminder to-enable this once the underlying problem has been fixed.
Running this in a loop: $ while true; do sleep 0.1; ./build/bin/lx -l test < src/lx/lexer.lx \ && echo ok; done Produces a stream of intermittent failures. There appears to be unsynchronized access to a shared/global resource, and races on either `realloc`ing or `free`ing it can nondeterministically lead to memory corruption. For now, change to using only one thread -- issue #351 exists as a reminder to-enable this once the underlying problem has been fixed.
Hm I can't reproduce this, I tried with and without asan, ubsan and efence. Any ideas? |
You need to set the concurrency flag (
still produces errors
It may depend somewhat on CPU load -- if I ran multiple processes of a busywait program to bog the CPU down the failures reduced in frequency, and they returned when I stopped the busywaiters. It used to fail without the |
Running the following command:
will produce a steady stream of memory-related errors in lx.
There appears to be a race on malloc/realloc on a shared pointer. I am going to post a PR in a moment that disables multithreading, this issue exists as a reminder to fix it later. It's currently a distraction from other more important work.
The text was updated successfully, but these errors were encountered: