alt-tab-macos icon indicating copy to clipboard operation
alt-tab-macos copied to clipboard

AltTab hangs when launched from the Applications folder on Ventura beta 5

Open zacharee opened this issue 1 year ago • 48 comments

Describe the bug

I updated to Ventura beta 5 today on my M1 Pro MBP and noticed that AltTab was hanging on launch.

After playing around with building my own version, I noticed that when run from the Applications folder it hangs. Otherwise (with the debug version that doesn't move itself to /Applications) it runs fine.

Steps to reproduce the bug

  1. Update to Ventura beta 5 on an M1 Mac.
  2. Try opening AltTab from the Applications folder and notice it hangs.
  3. Try opening a debug version of AltTab from the Applications folder and notice it hangs.
  4. Try opening a debug version of AltTab from elsewhere and notice it has no issues.

Note: I built my debug version with Xcode 14.0 beta 5.

zacharee avatar Aug 09 '22 19:08 zacharee

Could you better describe what you mean by "hanging"? Does it spins with high CPU?

If you can build it locally, could you then launch it in debug mode locally? You could then pause the debug and see where the execution is spending cycles or where it's blocking.

Alternatively, a spin dump from Activity Monitor would help diagnose the issue.

lwouis avatar Aug 09 '22 19:08 lwouis

Could you better describe what you mean by "hanging"? Does it spins with high CPU?

If you can build it locally, could you then launch it in debug mode locally? You could then pause the debug and see where the execution is spending cycles or where it's blocking.

Alternatively, a spin dump from Activity Monitor would help diagnose the issue.

As soon as it launches, it's marked as "not responding" in Activity Monitor. The menu bar icon consistently appears and the settings window occasionally appears but will have a beach ball of death. CPU usage is low.

The problem is that it only hangs if the .app is in /Applications. If I do a direct launch from AppCode there are no issues.

I can't seem to launch the debug executable inside /Applications through the terminal to get a log, either. It doesn't see it has screen recording permissions.

Here's a spindump:

Spindump.txt

zacharee avatar Aug 09 '22 19:08 zacharee

Even weirder: now the debug app only successfully launches if it's run through AppCode. Double-clicking in Finder causes it to hang no matter where the file is located.

zacharee avatar Aug 09 '22 20:08 zacharee

I can't seem to launch the debug executable inside /Applications through the terminal to get a log, either. It doesn't see it has screen recording permissions.

I think it will work if you give the permissions to Terminal.app. Could you try that?

Here's a spindump

It's a bit unclear what the main thread is blocking on. It seems to be some internals from Apple, not code from AltTab. It could indicate a regression in macOS. After all AltTab works on the previous macOS version, and the one you're on is a beta, so that's possibly the root cause here.

lwouis avatar Aug 09 '22 20:08 lwouis

That let me launch it through the terminal. This is the log:

zachary@zacharyMBP MacOS % ./AltTab 
"Current space" 1
"Adding app" 171 "com.apple.loginwindow"
"Adding app" 450 "com.apple.systemuiserver"
"Adding app" 446 "com.apple.dock"
"Adding app" 447 "com.apple.backgroundtaskmanagement.agent"
"Adding app" 449 "com.apple.controlcenter"
"Adding app" 455 "com.apple.WindowManager"
"Adding app" 445 "com.apple.talagent"
"Adding app" 451 "com.apple.finder"
"Adding app" 496 "com.apple.Spotlight"
"Adding app" 477 "com.apple.CoreLocationAgent"
"Adding app" 528 "com.google.Chrome"
"Adding app" 564 "com.apple.TextInputMenuAgent"
"Adding app" 527 "com.apple.notificationcenterui"
"Adding app" 555 "com.apple.AirPlayUIAgent"
"Adding app" 541 "com.apple.Siri"
"Adding app" 581 "com.apple.coreservices.uiagent"
"Adding app" 504 "com.apple.wifi.WiFiAgent"
"Adding app" 580 "com.apple.TextInputSwitcher"
"Adding app" 584 "com.BlueBubbles.BlueBubbles-Server"
"Adding app" 601 "com.microsoft.OneDrive"
"Adding app" 740 "com.spotify.client"
"Adding app" 741 "com.crowdcafe.windowmagnet"
"Adding app" 743 "com.IdeaPunch.ColorSlurp"
"Adding app" 744 "ai.krisp.krispMac"
"Adding app" 579 "com.teamviewer.Desktop"
"Adding app" 614 "com.apple.AppSSOAgent"
"Adding app" 553 "com.logi.cp-dev-mgr"
"Adding app" 746 "com.surteesstudios.Bartender"
"Adding app" 693 "com.apple.universalcontrol"
"Adding app" 550 "com.paragon-software.extfs.notification-agent"
"Adding app" 732 "com.google.chromeremotedesktop.me2me-host"
"Adding app" 538 "com.teamviewer.TeamViewer"
"Adding app" 729 "com.apple.security.Keychain-Circle-Notification"
"Adding app" 767 "com.google.drivefs"
"Adding app" 838 "com.apple.MobileSMS"
"Adding app" 847 "com.apple.SoftwareUpdateNotificationManager"
"Adding app" 881 "com.apple.locationmenu"
"Adding app" 1096 "com.hnc.Discord"
"Adding app" 1201 "com.apple.ActivityMonitor"
"Adding app" 1353 "com.apple.LocalAuthentication.UIAgent"
"Adding app" 1369 "com.apple.accessibility.universalAccessAuthWarn"
"Adding app" 2523 "com.apple.OSDUIHelper"
"Adding app" 3526 "ru.keepcoder.Telegram"
"Adding app" 4290 "com.apple.storeuid"
"Adding app" 4935 "com.apple.UserNotificationCenter"
"Adding app" 8993 "com.jetbrains.AppCode"
"Adding app" 9747 "com.apple.Family"
"Adding app" 10542 "com.apple.PowerChime"
"Adding app" 11831 "com.readdle.smartemail-Mac"
"Adding app" 13584 "com.apple.systempreferences"
"Adding app" 13623 "com.apple.Terminal"
"Adding app" 13943 "com.lwouis.alt-tab-macos"
2022-08-09 16:18:49.224 AltTab[13943:159378] It's not legal to call -layoutSubtreeIfNeeded on a view which is already being laid out.  If you are implementing the view's -layout method, you can call -[super layout] instead. Break on void _NSDetectedLayoutRecursion(void) to debug.  This will be logged only once.  This may break in the future.

zacharee avatar Aug 09 '22 20:08 zacharee

Also, AltTab worked fine on beta 4, so whatever changed happened very recently.

zacharee avatar Aug 09 '22 20:08 zacharee

I've that problem. I upgraded to macOS Ventura Beta 5 today. It has working to beta 4.

aliosmanyuksel avatar Aug 09 '22 20:08 aliosmanyuksel

Screenshot

aliosmanyuksel avatar Aug 09 '22 21:08 aliosmanyuksel

Same here :) on Beta 5

Write avatar Aug 09 '22 23:08 Write

Also, AltTab worked fine on beta 4, so whatever changed happened very recently.

can confirm, this has been driving me crazy

dalsvk avatar Aug 10 '22 03:08 dalsvk

Same problem. Upgraded to Beta 5 and now AltTab is stuck as Not Responding.

bradhs avatar Aug 10 '22 05:08 bradhs

2022-08-09 22:48:38.563 AltTab[3654:40136] It's not legal to call -layoutSubtreeIfNeeded on a view which is already being laid out. If you are implementing the view's -layout method, you can call -[super layout] instead. Break on void _NSDetectedLayoutRecursion(void) to debug. This will be logged only once. This may break in the future.

bradhs avatar Aug 10 '22 05:08 bradhs

Same for MacBookPro16,1 on Ventura Public Beta 3

GitSparTV avatar Aug 10 '22 09:08 GitSparTV

Same for MacBookPro 14 on Ventura Public Beta 3

MalwarePup avatar Aug 10 '22 13:08 MalwarePup

Could anyone here follow the error message and put a breakpoint on void _NSDetectedLayoutRecursion(void)? I don't have a VM with Ventura beta 5, so I can't reproduce this. On my Catalina machine, and my other VMs, I don't get this warning when running AltTab.

lwouis avatar Aug 10 '22 13:08 lwouis

I can't build this project. If you wanna connect to me via AnyDesk or Teamviewer, i can send my connection code. @lwouis mail: [email protected]

error

aliosmanyuksel avatar Aug 10 '22 13:08 aliosmanyuksel

getting this as well, can do a teamviewer too if needed

samdenty avatar Aug 10 '22 13:08 samdenty

Could anyone here follow the error message and put a breakpoint on void _NSDetectedLayoutRecursion(void)? I don't have a VM with Ventura beta 5, so I can't reproduce this. On my Catalina machine, and my other VMs, I don't get this warning when running AltTab.

Could you use https://github.com/insidegui/VirtualBuddy ?

Write avatar Aug 10 '22 13:08 Write

I'm not quite sure how to set a breakpoint on that function. I've tried [void _NSDetectedLayoutRecursion] and without brackets in AppCode's symbolic breakpoints menu but they don't catch it.

zacharee avatar Aug 10 '22 13:08 zacharee

I'm willing to help too, I have a VM Running beta 5, with anydesk, brew, and latest xcode installed. EDIT : @lwouis I sent you all the details of the VM, feel free to connect it to at any time, I'll try to keep it running.

Write avatar Aug 10 '22 18:08 Write

Same here. It seems like apple has changed some SDKs.

elijahchan2019 avatar Aug 11 '22 04:08 elijahchan2019

I'm in Venture Beta 5 and can accept any test request

Ashinch avatar Aug 11 '22 14:08 Ashinch

I was able to connect @Write's Ventura VM, and try and debug the issue. Thank you again @Write for trusting me to use your VM 👍

I could reach the symbolic breaking by breaking on _NSDetectedLayoutRecursion:

image

However, it's pretty useful as it doesn't show which specific window or view is generating the log/issue.

I tried to manually remove the preferences window, feedback window, main window, etc, to try and guess where the issue is coming from, but I can't deduce anything.

Furthermore, I tried to google various pieces of the error message from Apple, but nothing comes up that's relevant.

I'm afraid my time is limited (please see #1179), so I'll wait until Ventura is out of beta to give it a second look.

lwouis avatar Aug 11 '22 16:08 lwouis

I don't have any macOS coding knowledge, but I tried to look for what makes the app crash at launch, it seems to be in this function and has nothing to do with _NSDetectedLayoutRecursion since the error message is shown whether this line is commented out or not. But the app actually run when I comment out Applications.list.append(Application($0))

Screenshot du 2022-08-11 à 19 19 37

EDIT : Guessing you already saw that so I'm certainly making you lose your time, I'm sorry.

EDIT 2 : I managed to make it compile & work with an ugly """fix"" (don't know any side-effect, except, my guess is AltTab won't show itself when AltTabing). It always crashed when AltTab was adding itself to the list of apps. Screenshot du 2022-08-11 à 19 48 03

A video of AltTab somewhat working on Beta 5: https://share.socialspill.com/w/5890bb78635279715c3dc7b814ff3082

Write avatar Aug 11 '22 17:08 Write

Hi, I don't know if it counts as a solution, but it works for me, Remove altTab from your login items, Start your machine. After a few minutes, usually around 10 for me, start altTab, All is good now.

zaper4life avatar Aug 11 '22 18:08 zaper4life

Hi, I don't know if it counts as a solution, but it works for me, Remove altTab from your login items, Start your machine. After a few minutes, usually around 10 for me, start altTab, All is good now.

This workaround worked for me too, but I didn't have to restart my machine.

lilbillybiscuit avatar Aug 12 '22 02:08 lilbillybiscuit

Hi, I don't know if it counts as a solution, but it works for me, Remove altTab from your login items, Start your machine. After a few minutes, usually around 10 for me, start altTab, All is good now.

Did not work for me.

bradhs avatar Aug 12 '22 05:08 bradhs

Hi, I don't know if it counts as a solution, but it works for me, Remove altTab from your login items, Start your machine. After a few minutes, usually around 10 for me, start altTab, All is good now.

Did not work for me.

yup, same

dalsvk avatar Aug 12 '22 06:08 dalsvk

I don't have any macOS coding knowledge, but I tried to look for what makes the app crash at launch, it seems to be in this function and has nothing to do with _NSDetectedLayoutRecursion since the error message is shown whether this line is commented out or not. But the app actually run when I comment out Applications.list.append(Application($0))

Screenshot du 2022-08-11 à 19 19 37

EDIT : Guessing you already saw that so I'm certainly making you lose your time, I'm sorry.

EDIT 2 : I managed to make it compile & work with an ugly """fix"" (don't know any side-effect, except, my guess is AltTab won't show itself when AltTabing). It always crashed when AltTab was adding itself to the list of apps. Screenshot du 2022-08-11 à 19 48 03

A video of AltTab somewhat working on Beta 5: https://share.socialspill.com/w/5890bb78635279715c3dc7b814ff3082

Here's a debug build with my ugly fix, I think it'll only run on ARM and you'll certainly have to remove / re-add AltTab permissions manually. Please do not run it if you don't trust me.

~~AltTab.zip~~ Link removed, please use this link instead.

Write avatar Aug 12 '22 09:08 Write

I don't have any macOS coding knowledge, but I tried to look for what makes the app crash at launch, it seems to be in this function and has nothing to do with _NSDetectedLayoutRecursion since the error message is shown whether this line is commented out or not. But the app actually run when I comment out Applications.list.append(Application($0)) Screenshot du 2022-08-11 à 19 19 37 EDIT : Guessing you already saw that so I'm certainly making you lose your time, I'm sorry. EDIT 2 : I managed to make it compile & work with an ugly """fix"" (don't know any side-effect, except, my guess is AltTab won't show itself when AltTabing). It always crashed when AltTab was adding itself to the list of apps. Screenshot du 2022-08-11 à 19 48 03 A video of AltTab somewhat working on Beta 5: https://share.socialspill.com/w/5890bb78635279715c3dc7b814ff3082

Here's a debug build with my ugly fix, I think it'll only run on ARM and you'll certainly have to remove / re-add AltTab permissions manually. Please do not run it if you don't trust me.

AltTab.zip

tysm, it's working perfectly fine for me

dalsvk avatar Aug 12 '22 11:08 dalsvk