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

MSVC crash stacktrace without debug symbols wrongly points to embree and oidn symbols #69295

Closed
akien-mga opened this issue Nov 28, 2022 · 2 comments · Fixed by #69332
Closed

Comments

@akien-mga
Copy link
Member

Godot version

4.0.beta (166066d)

System information

Windows, MSVC custom builds

Issue description

I keep seeing stacktraces with false positives from custom MSVC builds, of this form:

CrashHandlerException: Program crashed
Engine version: Godot Engine v4.0.beta.custom_build (https://github.com/godotengine/godot/commit/166066d9f74e574b68d9f9d0ba05bf42b8de2131)
Dumping the backtrace. Please include this when reporting the bug on: [godotengine/godot/issues](https://github.com/godotengine/godot/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)
[0] <couldn't map PC to fn name>
[1] <couldn't map PC to fn name>
[2] embree::TaskScheduler::wait
[3] oidnUnmapBuffer
[4] oidnUnmapBuffer

...

[42] oidnUnmapBuffer
[43] oidnUnmapBuffer
[44] oidnUnmapBuffer
[45] embree::TaskScheduler::wait
[46] embree::TaskScheduler::wait
[47] embree::TaskScheduler::wait
[48] <couldn't map PC to fn name>
[49] <couldn't map PC to fn name>
[50] <couldn't map PC to fn name>
[51] <couldn't map PC to fn name>
[52] embree::TaskScheduler::wait
[53] BaseThreadInitThunk
-- END OF BACKTRACE --

(This one is from #69259 (comment) but there's plenty other examples.)

Such crashes do NOT occur in embree or oidn. Instead, it seems to be more a case of those libraries polluting the global namespace and we wrongly resolve to their symbols.

Would be good to find how to prevent this false positive, it's one thing to have a useless backtrace due to missing debug symbols, but it's worse when it wrongly points to symbols which wouldn't be involved in the crash.

Steps to reproduce

  • Compile Godot with MSVC, without debug symbols
  • Make it crash

(Didn't test exact steps to reproduce as I'm not on Windows currently.)

Minimal reproduction project

n/a

@bruvzg
Copy link
Member

bruvzg commented Nov 29, 2022

It's likely caused by dllexport / visibility (in practice only relevant for building as shared library, and used in some other third party code). So it's probably picking the function name with the closest address (and only exported function names are known).

#ifdef _WIN32
#  define OIDN_API extern "C" __declspec(dllexport)
#else
#  define OIDN_API extern "C" __attribute__ ((visibility ("default")))
#endif

I'm not sure if we should have backtrace enabled when building without symbols at all, it's completely useless anyway. But it is possible to force it to use only matching PDB.

@akien-mga
Copy link
Member Author

I'm not sure if we should have backtrace enabled when building without symbols at all, it's completely useless anyway.

Yeah it doesn't make much sense without symbols. But can we know at runtime whether or not we have symbols available, to decide what to do? Deciding it at compile time could work but it would mean that you building with debug symbols, and then stripping the binary / skipping the .pdb would behave differently to building without debug symbols (while currently it's more or less equivalent).

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