-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Neko thread usage causes seg faults during global free #281
Comments
On Ubuntu, threads can cause seg faults, see: HaxeFoundation/neko#281
Haxelib was causing CI failures in the Ubuntu runners due to a threading issue with neko: HaxeFoundation/neko#281
* Patch haxelib to avoid segmentation faults Haxelib was causing CI failures in the Ubuntu runners due to a threading issue with neko: HaxeFoundation/neko#281 * Update haxelib for run.n fix
On Ubuntu, threads can cause seg faults, see: HaxeFoundation/neko#281
We just had a similar crash on Windows, so looks like it's not specific to Linux:
-1073741819 is equivalent to 0xC0000005, which is |
This sample seems to reproduce the seg fault some of the time, at least on my windows machine: function main() {
final streamsLock = new sys.thread.Lock();
sys.thread.Thread.create(function() {
Sys.sleep(0.2);
streamsLock.release();
});
sys.thread.Thread.create(function() {
Sys.sleep(0.2);
streamsLock.release();
});
streamsLock.wait();
streamsLock.wait();
}
|
Here is a haxe sample that reproduces the seg fault more reliably: function main() {
sys.thread.Thread.create(function() {
while(true) {
trace("Hello 1");
}
});
sys.thread.Thread.create(function() {
while (true) {
trace("Hello 2");
}
});
} |
It looks like this happens because the thread is deleted by DLLMain Somehow this happens at the same time as the See separate issue: #303 |
Ever since haxelib was updated to use threads on neko, it has been segfaulting randomly in github actions. e.g.
I haven't been able to reproduce at all on any local systems, but I did some troubleshooting and I found that the seg fault occurs after the main function is completed, at some point after this call, but before the program closes: https://github.com/HaxeFoundation/neko/blob/master/vm/main.c#L342.
I managed to download the core dump and load it, and it says that the seg fault comes from line 46 here:
neko/vm/callback.c
Lines 44 to 48 in 9076cfa
I later added a printf here and confirmed that during the segfault, vm is a null pointer. Perhaps there is a finaliser that is getting called after the main function has already finished or something?
Full backtrace
Here is the code in haxelib that uses threads: https://github.com/HaxeFoundation/haxelib/blob/4.1.x/src/haxelib/client/Vcs.hx#L162-L177
The text was updated successfully, but these errors were encountered: