Skip to content

Fix application freezing on macOS when trace_tracy is enabled#23201

Open
xremming wants to merge 2 commits intobevyengine:mainfrom
xremming:tracy-macos-freeze-fix
Open

Fix application freezing on macOS when trace_tracy is enabled#23201
xremming wants to merge 2 commits intobevyengine:mainfrom
xremming:tracy-macos-freeze-fix

Conversation

@xremming
Copy link

@xremming xremming commented Mar 3, 2026

Objective

On macOS (26.3) enabling tracy for tracing causes Bevy to freeze here.

https://github.com/bevyengine/bevy/blob/release-0.18.1/crates/bevy_render/src/diagnostic/tracy_gpu.rs#L64

I assume this problem is likely related to the same root cause as #22365.

Solution

  • Short circuit and return 0 on macOS.
    • It's probably not correct but it works. 🤷🏼‍♀️

Testing

  • Tested locally by patching Bevy to the fixed version.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Welcome, new contributor!

Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨

@xremming xremming changed the base branch from main to release-0.18.1 March 3, 2026 12:36
@xremming xremming marked this pull request as ready for review March 3, 2026 12:43
@xremming xremming force-pushed the tracy-macos-freeze-fix branch from e7e8bfb to e7fcc1d Compare March 3, 2026 12:47
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-23201

If it's expected, please add the M-Deliberate-Rendering-Change label.

If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it.

@kfc35 kfc35 added O-MacOS Specific to the MacOS (Apple) desktop operating system C-Bug An unexpected or incorrect behavior S-Needs-Review Needs reviewer attention (from anyone!) to move forward A-Rendering Drawing game state to the screen labels Mar 3, 2026
@github-project-automation github-project-automation bot moved this to Needs SME Triage in Rendering Mar 3, 2026
@kfc35 kfc35 added the D-Straightforward Simple bug fixes and API improvements, docs, test and examples label Mar 3, 2026
@kfc35
Copy link
Contributor

kfc35 commented Mar 3, 2026

@xremming Just confirming that you meant to point this PR to be merged into the release-0.18.1 branch? Since 0.18.1 has been released already, I think it might be too late to merge a fix into that branch.

Does this issue appear on main? If so, I think it’s better to point this PR to be merged into main, and then we can tag it appropriately for inclusion in the correct milestone

@alice-i-cecile alice-i-cecile added the S-Needs-Testing Testing must be done before this is safe to merge label Mar 3, 2026
@alice-i-cecile
Copy link
Member

Indeed: we should point this to main, then cherrypick it to 0.18.2 if needed.

@alice-i-cecile alice-i-cecile added S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Mar 3, 2026
@alice-i-cecile alice-i-cecile added this to the 0.18.2 milestone Mar 3, 2026
@alice-i-cecile alice-i-cecile requested a review from aevyrie March 3, 2026 16:48
@xremming
Copy link
Author

xremming commented Mar 3, 2026

@kfc35 I did indeed point this to 0.18.1 branch for a reason, which is that it's where I made the fix at for myself for (and tested it). I can rebase this to main if that's preferable.

However 0.18.1 is not yet released at crates.io?

@alice-i-cecile
Copy link
Member

I can rebase this to main if that's preferable.

Yes, this needs to be rebased :)

However 0.18.1 is not yet released at crates.io?

Correct; just waiting for final sign-off from fellow maintainers.

@xremming xremming force-pushed the tracy-macos-freeze-fix branch from e7fcc1d to 8a86699 Compare March 3, 2026 17:27
@xremming xremming changed the base branch from release-0.18.1 to main March 3, 2026 17:27
@xremming
Copy link
Author

xremming commented Mar 3, 2026

Rarely does a rebase work on the first try as intended... Nice.

Tested it out with and without the patch on main against the 3d_shapes example and can confirm the fix still works (and is still required).

@xremming
Copy link
Author

xremming commented Mar 3, 2026

Would be interesting if someone with an older macOS version could test this. Seeing that it has worked on macOS previously, at least based on the profiling.md that has a screenshot from macOS.

This also made me wonder if this will need to be gated on iOS too. 🤔 I remember seeing an issue about supporting Tracy on iOS and Android. Perhaps another PR will be required to rework the GPU profiling based on support for it.

@kfc35 kfc35 added S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Mar 4, 2026
Backend::Vulkan => GpuContextType::Vulkan,
Backend::Dx12 => GpuContextType::Direct3D12,
Backend::Gl => GpuContextType::OpenGL,
Backend::Metal | Backend::BrowserWebGpu | Backend::Noop => GpuContextType::Invalid,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we even bother continuing if we hit an invalid backend - could we just make this function fallible and do nothing on unsupported platforms? Then we can stop worrying about these hacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples O-MacOS Specific to the MacOS (Apple) desktop operating system S-Needs-Review Needs reviewer attention (from anyone!) to move forward S-Needs-Testing Testing must be done before this is safe to merge

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

5 participants