-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
SIGSEGV in alloc.nim addToSharedFreeList() in heavily threaded code #21062
Comments
We found the same bug but don't have an easy to reproduce example either, unfortunately. |
Ok, cool, thanks for confirming. I assume this ticket is a duplicate, what is the original? I do have some code to run that reproduces 80% of the time, but it's not nice and standalone; let me know if you are interested, I can give instructions how to run. |
There is not one yet. @ringabout is also investigating. |
Verified to fix my case, thanks |
Description
In one of my projects I'm making quite heavy use of threads; I am only able to get this code to run stable when using
-d:useMalloc
; when using the default Nim memory allocator I can consistently reproduce crashes.Unfortunately I am not able to reduce to a minimal reproduction example yet.
I have no proof the Nim allocator is the root cause of the problem and not my code, but the code runs 100% clean under valgrind, helgrind, asan and tsan when using
-d:useMalloc
, but is problematic under all of these tools when using the Nim allocator.Symptoms are at least a
SIGSEGV
at runtime. gdb output, valgrind and helgrind logs are attached below. gdb backtrace indicates thataddToSharedFreeList()
gets called withnil
forf
.Helgrind seems to indicate a race between
compensateCounters()
andaddToSharedFreeList()
Not likely to be related, but ringabout mentioned a "Weird bug 2:" related to the
compensateCounters()
function in #20884 recently here: #20884 (comment)valgrind.log
helgrind.log
Nim Version
Nim Compiler Version 1.7.3 [Linux: amd64]
Compiled at 2022-12-06
Copyright (c) 2006-2022 by Andreas Rumpf
git hash: 047c9fb08a4daae1fac251e43cef9c7ec5350110
active boot switches: -d:release -d:danger
Current Output
Expected Output
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: