Skip to content

Conversation

@mujacica
Copy link
Contributor

  • Prevent usage of internal UE logger during crash handling
  • Disable console logging for Windows crashes

@mujacica mujacica marked this pull request as ready for review September 19, 2025 08:56
@mujacica mujacica merged commit 7aa553c into main Sep 19, 2025
30 checks passed
@mujacica mujacica deleted the disable_on_crash_logging branch September 19, 2025 12:50
@nwhite-riot
Copy link
Collaborator

@mujacica, @tustanivsky, can I ask what this was for? It actually makes the log file worse because Unreal doesn't flush logs, losing a number of ticks of logs (including the actual tick before the crash). I'd even opened a ticket to replicate the log flush behavior on Xbox because it improved the output: https://github.com/getsentry/sentry-xbox/issues/36.

This ticket doesn't explain why this is necessary.

@mujacica
Copy link
Contributor Author

mujacica commented Oct 3, 2025

Hey @nwhite-riot, the reason for this is mainly trying to address #992 and #991. So in general, if anything goes wrong with UE Allocator/Stack, calling UE_LOG would cause a secondary crash of Sentry Subsystem, so we would not get the event at all. The solution that we did here was not ideal, but if you have any ideas on how to support Allocator/Overflow problems, while at the same time flushing the logs when the crash happens, I am glad to discuss.

@nwhite-riot
Copy link
Collaborator

nwhite-riot commented Oct 3, 2025

Does Ivan's comment not resolve this: #992 (comment)? Specifically:

We'll check if it's feasible to pre-allocate the required amount of memory (e.g. after the SDK initialization) and ensure that the crash stack trace is properly added to logs

Does pre-allocating memory for the string allocation not resolve this issue?

To be clear, Unreal performs this same logic when it handles crashes, so I'd be surprised if the logic was fundamentally flawed.

@mujacica
Copy link
Contributor Author

mujacica commented Oct 3, 2025

Sadly, it does not. We can pre-allocate memory in our code, but since both StackWalk and Logger itself are allocating (using Unreal allocators) internally, it doesn't solve the problem.

I spent quite some time testing this, and with poisoning memory allocator and/or causing stack overflow, a call to UE_LOG/GLog would cause secondary crashes. But as I said, maybe there is a way around it. One of the things we were discussing was sending these logs via Sentry Logs.

@nwhite-riot
Copy link
Collaborator

I'm assuming this is a problem because we're handling the crash on the main thread - hence why a stackoverflow blows this up. CRC handles writing these logs on a separate thread, so is there a way we can offload this to a separate thread? I realize things like the screenshots etc. require the game thread, but that doesn't mean everything has to be

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

Successfully merging this pull request may close these issues.

4 participants