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

Tracy Profiler crash on startup in Worker mutex lock with access violation on Windows #887

Closed
egorodet opened this issue Sep 23, 2024 · 7 comments

Comments

@egorodet
Copy link

tracy-profiler.exe downloaded from GitHub releases v0.11.0 and v0.11.1 does not start silently.

When I build Tracy Profiler from sources, it works normally in Debug build, but crashes in Release and ReleaseWithDebInfo builds on attempt to lock mutex from thread loop of ResolvService::Worker(). Issue is reproducible on master, v0.11.1 and v0.11.0. Previous release of Tracy v0.10 was working fine.

Tracy-Mutex-Crash-2

Tracy-Mutex-Crash-1

Build command line:

cd X:\Git\Tracy\profiler
cmake -S . -B Build -G "Visual Studio 17 2022" -A x64
cmake --build Build --config Release

System Information:

  • Windows 11 Pro 23H2 22631.4169
  • Microsoft Visual Studio Enterprise 2022 v17.11.3
@wolfpld
Copy link
Owner

wolfpld commented Sep 23, 2024

See #862. The fact that you have MSVC 17.11 doesn't fit though.

@egorodet
Copy link
Author

See #862. The fact that you have MSVC 17.11 doesn't fit though.

Oh, now I see. Looks like a new disaster :((( I though that MSVC Runtime is auto-updated by Visual Studio Installer along with other updates, but seems like it does not...

Maybe instead of updating runtimes, it would be better to add definition _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR (as suggested by Microsoft) to return compatibility with old runtime versions?

@egorodet
Copy link
Author

Btw, I've downloaded latest MSVC runtime installer v14.40.33810.0 from here and it says that it is already installed! What's next?

image

@wolfpld
Copy link
Owner

wolfpld commented Sep 23, 2024

Oh, now I see. Looks like a new disaster :((( I though that MSVC Runtime is auto-updated by Visual Studio Installer along with other updates, but seems like it does not...

Oh wow, so you can end up with a MSVC that produces binaries that can't run? That's a new low, even for MSVC.

Maybe instead of updating runtimes, it would be better to add definition _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR (as suggested by Microsoft) to return compatibility with old runtime versions?

Yeah, this felt super-hacky to me, but considering the new circumstances, that may be the right way to go.

7792b95 has this enabled.

@egorodet
Copy link
Author

7792b95 has this enabled.

Yep, with this definition added, Tracy Profiler runs perfectly fine with MSVC runtime unchanged!

image

@wolfpld wolfpld closed this as completed Sep 23, 2024
@mattico
Copy link

mattico commented Sep 24, 2024

I ran into this issue as well. I definitely have the most recent MSVCRT installed, and even my locally built versions of tracy would sometimes have this issue.

I think I figured out the cause using Dependency Walker. The exe is loading api-ms-win-core-*.dll from Microsoft's JDK, which inserted itself into the PATH before C:\Windows, etc. The JDK evidently bundles an old version of MSVCRT. I suspect something similar is the cause of the issue for anyone who has the latest MSVCRT installed.

I'm not sure what the "proper" fix is supposed to be for this issue. They seem to discourage bundling those api-ms-win-core-*.dll, and it looks like the app is only supposed to go searching for DLLs in PATH as a last resort if it doesn't find the DLL in PWD or C:\Windows or WinSxS, or whatever. Anyway the workaround works fine.

@egorodet
Copy link
Author

I ran into this issue as well. I definitely have the most recent MSVCRT installed, and even my locally built versions of tracy would sometimes have this issue.

I think I figured out the cause using Dependency Walker. The exe is loading api-ms-win-core-*.dll from Microsoft's JDK, which inserted itself into the PATH before C:\Windows, etc. The JDK evidently bundles an old version of MSVCRT. I suspect something similar is the cause of the issue for anyone who has the latest MSVCRT installed.

I'm not sure what the "proper" fix is supposed to be for this issue. They seem to discourage bundling those api-ms-win-core-*.dll, and it looks like the app is only supposed to go searching for DLLs in PATH as a last resort if it doesn't find the DLL in PWD or C:\Windows or WinSxS, or whatever. Anyway the workaround works fine.

@wolfpld This looks like a root-cause of this weird issue with MSVC runtimes conflict.

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