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

lldb hangs 1-2s on window example when Ctrl+key / Cmd+key pressed for the first time #3760

Open
zhaop opened this issue Jun 25, 2024 · 1 comment
Labels
B - bug Dang, that shouldn't have happened DS - macos

Comments

@zhaop
Copy link

zhaop commented Jun 25, 2024

Description

When I run the window example with lldb:

cargo build --example window && lldb -o run target/debug/examples/window

and when I press Ctrl+key or Cmd+key for the first time, lldb hangs for a while and loads a bunch of symbol tables with Apple-sounding names, which causes the example app to hang for 1-2s. Subsequent shortcut presses do not cause this hang.

I've bisected this behavior to 075996b, which fixes #3231 "feat: macos services menu added". Prior to this commit, reproducing the steps above does not cause a hang.

This also happens when I launch the window example as above, then go to the top left corner of my screen and hover over the "Services >" menu item -- lldb also loads symbol tables for 1-2 seconds, the "Services" menu item hangs, and then after that, the Services submenu appears.

image

This issue came from Bevy issue 14010.

macOS version

ProductName:                macOS
ProductVersion:         14.3.1
BuildVersion:           23D60

Winit version

0.30.0

@madsmtm
Copy link
Member

madsmtm commented Jun 25, 2024

I can reproduce the issue, removing the setServicesMenu call in

unsafe { app.setServicesMenu(Some(&services_menu)) };
prevents the hang.

The hang is also present in bog-standard applications created via. Xcode, try creating a new Xcode app, restart Xcode (or kill the lldb-rpc-server process), debug the application, and then close it with CMD + Q. The hang is less noticeable there because:

  1. They spawn a LLDB server, so during normal development flow the symbol table is cached (it's only present the first time debugging after Xcode launches).
  2. Xcode's LLDB seems to do less work at this stage, maybe some custom configuration, maybe changes in their fork, so instead of 1-2 seconds it only takes what feels like half a second.

In any case, I'm not sure what you want Winit to do about it? Maybe you could file an issue with LLDB or Apple instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B - bug Dang, that shouldn't have happened DS - macos
Development

No branches or pull requests

2 participants