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

startup error on Windows11 24H2 #957

Open
Niteip opened this issue Nov 4, 2024 · 15 comments
Open

startup error on Windows11 24H2 #957

Niteip opened this issue Nov 4, 2024 · 15 comments

Comments

@Niteip
Copy link

Niteip commented Nov 4, 2024

My program uses the mimalloc dynamic library, and when it starts on Windows 11 24H2, a popup error occurs stating, "The application was unable to start correctly (0xc0000142). Click OK to close the application." I have tested it and found that it works normally on Windows 11 23H2. Currently, I have switched the dynamic library to a static library, and users on Windows 11 24H2 are not encountering any startup errors.

@Niteip
Copy link
Author

Niteip commented Nov 4, 2024

Sorry for forgetting to mention that I am using version 2.1.7 of mimalloc

@daanx
Copy link
Collaborator

daanx commented Nov 4, 2024

Yikes -- that's a bit scary. I recently updated the redirection dll; can you perhaps try with the latest dev-slice branch if you still see the same issue? (I am currently traveling and have no easy means to set up a test environment now).

Also, if it still fails, can you try with the environment variable MIMALLOC_VERBOSE=3 and see if there is any error output?

@vitalyt79
Copy link

vitalyt79 commented Nov 4, 2024

I have the same problem with the latest mimalloc-redirect.dll version

Unhandled exception at 0x00007FF891B55CC9 (ntdll.dll) in 1.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

Call stack:

ntdll.dll!RtlUnicodeStringToAnsiString() Unknown
mimalloc-redirect.dll!00007ff86ca94007() Unknown
mimalloc-redirect.dll!00007ff86ca95289() Unknown
mimalloc-redirect.dll!00007ff86ca92f33() Unknown
ntdll.dll!LdrEnumerateLoadedModules() Unknown
mimalloc-redirect.dll!00007ff86ca9302a() Unknown
mimalloc-redirect.dll!00007ff86ca9597e() Unknown
mimalloc-redirect.dll!00007ff86ca92a40() Unknown
mimalloc-redirect.dll!00007ff86ca9237b() Unknown
ntdll.dll!LdrpCallInitRoutine() Unknown
ntdll.dll!LdrpInitializeNode() Unknown
ntdll.dll!LdrpInitializeGraphRecurse() Unknown
ntdll.dll!LdrpInitializeGraphRecurse() Unknown
ntdll.dll!LdrpInitializeGraphRecurse() Unknown
ntdll.dll!LdrpInitializeProcess() Unknown
ntdll.dll!_LdrpInitialize() Unknown
ntdll.dll!LdrpInitializeInternal() Unknown
ntdll.dll!LdrInitializeThunk() Unknown

@daanx
Copy link
Collaborator

daanx commented Nov 5, 2024

Ah great -- thanks, I'm looking into it. It is a bit strange to see an access violation inside ntdll though...
(I looked but couldn't find an obvious mistake on my side so I need to somehow set up a test environment with Win11 24H2, this may take a bit as I am traveling)

@daanx
Copy link
Collaborator

daanx commented Nov 5, 2024

I updated mimalloc-redirect in the latest dev and dev-slice. This might fix the issue (but probably not). If you can try it that would be great.

@vitalyt79
Copy link

It didn't work for me, the same error.

@daanx
Copy link
Collaborator

daanx commented Nov 5, 2024

Ok -- I need to get my hands on a 24H2 windows version then -- that would be earliest later next week though :-(

@vitalyt79
Copy link

ok, thanks a lot. BTW I'm using version 2.0.3.

@Niteip
Copy link
Author

Niteip commented Nov 5, 2024

I updated mimalloc-redirect in the latest dev and dev-slice. This might fix the issue (but probably not). If you can try it that would be great.

Thank you for your work. I will test it tomorrow.

@Niteip
Copy link
Author

Niteip commented Nov 7, 2024

I updated mimalloc-redirect in the latest dev and dev-slice. This might fix the issue (but probably not). If you can try it that would be great.

I conducted two tests,
Test 1: Download dev, compile and obtain mimalloc-override.dll and mimalloc-redirect.dll, run, and get an error 0xc0000142
Test 2: Download dev-slice, perform the above steps, run it, and also report an error 0xc0000142
Then I tried compiling with MIMALLOC_VERBOSE=3, but I realized that when the error 0xc0000142 occurred, my program did not output any log files that it should have. What I mean is: Windows has a loader that does a bunch of checks on the program when it tries to run it, and only if it passes those checks does it create a process and then execute WinMain(). I guess that the error 0xc0000142 is not passed during the check stage, so there is no output log file, which means that MIMALLOC_VERBOSE=3 will not bring information.

@daanx
Copy link
Collaborator

daanx commented Nov 17, 2024

I got my hands on Windows 24H2, version 10.0.26100.2314 (use winver to see this).

I could not reproduce the issue though.

I see patch 2314 came out on Nov 12 -- maybe this fixed the issue? Can you try this?

@Niteip
Copy link
Author

Niteip commented Nov 19, 2024

I got my hands on Windows 24H2, version 10.0.26100.2314 (use winver to see this).

I could not reproduce the issue though.

I see patch 2314 came out on Nov 12 -- maybe this fixed the issue? Can you try this?

On my machine, winver shows 26100.1742

@Niteip
Copy link
Author

Niteip commented Nov 19, 2024

I got my hands on Windows 24H2, version 10.0.26100.2314 (use winver to see this).

I could not reproduce the issue though.

I see patch 2314 came out on Nov 12 -- maybe this fixed the issue? Can you try this?

I tried the 2314 patch (downloaded from https://www.windowslatest.com/2024/11/12/windows-11-kb5046617-24h2-out-with-fixes-direct-download-msu/), after installing it and restarting my computer, winver showed 26100.2314.

Then, when I ran my program, the error 0xc0000142 still persisted.

@Niteip
Copy link
Author

Niteip commented Nov 19, 2024

I got my hands on Windows 24H2, version 10.0.26100.2314 (use winver to see this).

I could not reproduce the issue though.

I see patch 2314 came out on Nov 12 -- maybe this fixed the issue? Can you try this?

I tried to create a new project with VS, a console application, and then introduced mimalloc (using the same dynamic libraries, mimalloc-override.dll and mimalloc-redirect.dll, following the same steps). When I ran it on Windows 11 24H2, everything worked fine, and the console printed "Hello World!".

Oh my goodness, now I'm completely at a loss. I don't know how to solve the issue with my program.

@vitalyt79
Copy link

For me the problem was solved after I added the inclusion of the <mimalloc-new-delete.h> to the file that contains the main function.

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

No branches or pull requests

3 participants