-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
Segfault with TLS and std.parallelism on macOS #2187
Comments
Does your code use fibres that move across threads? If no, it's not related to #666. |
Not explicitly and no fibers are used explicitly. The application is creating a new task ( |
I got some help from Russel Winder to try this directly on Linux (not inside a Docker environment), the problem does not occur. So it seems to be macOS specific. |
Are you using the shared or static libs? If shared, could you give the static ones a try and see if those are affected too? |
I'm using what's default from the release provided here on GitHub. Looks like that's the static libs. |
I got a similar problem on macOS (does not occur on other systems or with DMD). From a coarse look, it appears that the TLS section of the non-main thread in the repro case is not scanned correctly when the collection is triggered by the main thread: https://gist.github.com/s-ludwig/5b924673b826c4c8427c0a5460631ba9 (edit: LDC 1.12.0) |
For reference, related forum thread with a working fix: https://forum.dlang.org/post/mailman.6193.1546546742.29801.digitalmars-d-ldc@puremagic.com It just wasn't clear yet under which circumstances the fix is actually needed. |
Proper (?) fix proposed by Iain upstream: dlang/druntime#2558 |
1.20.0-beta1 appears to work fine, so I think this can be closed, unless @jacob-carlborg actually hit a different issue, |
Ah yeah, I've forgotten about this - the upstream fix was cherry-picked into LDC v1.19. |
The code looks different now. It's now using |
Let's close this then, zombie issues aren't really helpful. |
I'm working on adding support for building DStep with LDC. Some of the tests are failing due to a segmentation fault, which seems related to using
std.parallelism
together with a TLS variable. The issue seems to only occur on macOS, at least it doesn't occur in Travis CI in a Docker environment. Running the test in a debugger gives back this stack trace:The segmentation fault occurs here [1].
std.parallelism
is used here [2][3]. If I remove the usage ofstd.parallelism
or making the TLS variable global the segmentation fault does not occur.The command I've been using to reproduce this is:
Unfortunatley I haven't spent any time on trying to reduce the test case, because I noticed that the variable is never written to, so making it
immutable
fixed the issue and made it more correct as well.This issue might be the same as #666, but I'm not entirely sure since the issue did not occur in Travis CI on Linux using Docker. It does occur in Travis CI on macOS.
I've tried using both LDC 1.2.0 and 1.3.0-beta2, on macOS 10.12.5.
[1] https://github.com/jacob-carlborg/dstep/blob/cc83cbc4523878ed6cec500e581d8e46534223db/dstep/translator/IncludeHandler.d#L214
[2] https://github.com/jacob-carlborg/dstep/blob/cc83cbc4523878ed6cec500e581d8e46534223db/dstep/driver/Application.d#L84-L89
[3] https://github.com/jacob-carlborg/dstep/blob/cc83cbc4523878ed6cec500e581d8e46534223db/dstep/driver/Application.d#L92-L93
The text was updated successfully, but these errors were encountered: