openfl / lime

A foundational Haxe framework for cross-platform development
https://lime.openfl.org/
MIT License
749 stars 359 forks source link

Sys.exit hangs the process on the latest 8.2.0-Dev branch #1803

Open 47rooks opened 3 weeks ago

47rooks commented 3 weeks ago

Haxe 4.3.4 lime 8.2.0-Dev from https://github.com/openfl/lime/actions/runs/9472284613 HL 1.14. Windows 10

this repros on HL, but I have seen in cpp as well in another project. I expect this will do the same.

I just used the HelloWorld sample and added a key up test for the ESCAPE key:

    public override function onKeyUp(key:KeyCode, modifier:KeyModifier):Void {
        switch (key) {
            case ESCAPE:
                Sys.exit(0);
            default:
        };
    }

build and run the program. Monitor it from MS ProcessExplorer Pop up the process specific window and watch the Threads tab. Once it renders hit the ESCAPE key. It will kill off all but the main program thread. If you check the stack from this thread you'll see something very like:

ntdll.dll!NtWaitForAlertByThreadId+0x14
ntdll.dll!RtlSleepConditionVariableSRW+0x131
KERNELBASE.dll!SleepConditionVariableSRW+0x29
lime.hdll!hid_write_output_report+0x9c175
lime.hdll!alIsEffect+0x521e
lime.hdll!alIsEffect+0x94f6
lime.hdll!alcDestroyContext+0x118
lime.hdll!lime_hl_al_delete_source+0xa2
lime.hdll!hid_write_output_report+0xe85d1
lime.hdll!hid_write_output_report+0xe8375
lime.hdll!hid_write_output_report+0xe86a9
lime.hdll!hid_write_output_report+0xca825
lime.hdll!hid_write_output_report+0xca799
lime.hdll!hid_write_output_report+0xca923
lime.hdll!hid_write_output_report+0xbc58f
lime.hdll!hid_write_output_report+0xbce1d
lime.hdll!hid_write_output_report+0xbcf39
ntdll.dll!RtlActivateActivationContextUnsafeFast+0x11d
ntdll.dll!LdrShutdownProcess+0x22a
ntdll.dll!RtlExitUserProcess+0xad
KERNEL32.DLL!FatalExit+0xb
ucrtbase.dll!exit+0x1dc
ucrtbase.dll!exit+0x7f
libhl.dll!hl_sys_exit+0x1e
47rooks commented 3 weeks ago

Forgot to mention that using lime.system.System.exit() instead of Sys.exit() does work.

player-03 commented 3 weeks ago

This doesn't seem to happen on Linux, so I assume it's Windows-specific.