Skip to content
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

druntime threads cleanup bug? #96

Closed
mw66 opened this issue Nov 1, 2022 · 1 comment · Fixed by #97
Closed

druntime threads cleanup bug? #96

mw66 opened this issue Nov 1, 2022 · 1 comment · Fixed by #97

Comments

@mw66
Copy link

mw66 commented Nov 1, 2022

I think I run into this:

https://github.com/huntlabs/hunt/blob/master/source/hunt/util/DateTime.d#L430

My program almost finished, and received signal SIGSEGV, Segmentation fault.

(gdb) where
#0  0x0000155550afac70 in __GI___nanosleep (requested_time=0x155544810e90, remaining=0x155544810ea8) at ../sysdeps/unix/sysv/linux/nanosleep.c:28
#1  0x0000555555fb8c3b in _D4core6thread8osthread6Thread5sleepFNbNiSQBo4time8DurationZv ()
#2  0x0000555555d9a0c2 in _D4hunt4util8DateTimeQj25_sharedStaticCtor_L406_C5FZ9__lambda4MFZv () at 
/.dub/packages/hunt-1.7.16/hunt/source/hunt/util/DateTime.d:430
#3  0x0000555555fb89f4 in thread_entryPoint ()
#4  0x0000155550af06db in start_thread (arg=0x155544817700) at pthread_create.c:463
#5  0x0000155550263a3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

I think it could be a druntime threads cleanup bug? Not sure how to fix it.

@mw66
Copy link
Author

mw66 commented Nov 1, 2022

I saw the tick() method call inside the anonymous dateThread is accessing these two stack variables of shared static this():

https://github.com/huntlabs/hunt/blob/master/source/hunt/util/DateTime.d#L409

    Appender!(char[])[2] bufs;
    const(char)[][2] targets;

Why does this tick() call work after the static this() finished in a normal run?

Why the problem only shows up when program finish?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant