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

AltTab sometimes doesn't respond quickly; it has high CPU usage #3986

Open
yarmoliq opened this issue Dec 16, 2024 · 22 comments
Open

AltTab sometimes doesn't respond quickly; it has high CPU usage #3986

yarmoliq opened this issue Dec 16, 2024 · 22 comments
Labels
bug Something isn't working unreproducible Need help from the author to reproduce the issue

Comments

@yarmoliq
Copy link

yarmoliq commented Dec 16, 2024

Describe the bug

After recent update there is a big delay between I can switch between windows and see any pop up (basically using alttab). Looking at activity monitor, I see that alttab creates huge spikes of CPU usage. Yesterday when this started happening I updated again, but it didn't fix the issue. I have reported this bug through built-in feedback thingy with cpu information. Just wanted to duplicate it here so there is awareness.

image

Your environment

  • AltTab version: 7.12.0
  • macOS version: 15.2 (24C101)
  • Other relevant info: no nothing
Debug profile

  • App version: 7.12.0
  • App preferences:
    • MSAppCenter310AppCenterUserDefaultsMigratedKey: 1
    • MSAppCenter310CrashesUserDefaultsMigratedKey: 1
    • MSAppCenterInstallId: BEC9E98A-0C10-4934-96AB-9B26316D53E3
    • MSAppCenterNetworkRequestsAllowed: 0
    • MSAppCenterPastDevices: {length = 1144, bytes = 0x62706c69 73743030 d4010203 04050607 ... 00000000 00000384 }
    • MSAppCenterSessionIdHistory: {length = 460, bytes = 0x62706c69 73743030 d4010203 04050607 ... 00000000 00000156 }
    • MSAppCenterUserIdHistory: {length = 455, bytes = 0x62706c69 73743030 d4010203 04050607 ... 00000000 00000151 }
    • NSStatusItem Visible Item-0: 0
    • NSWindow Frame SUStatusFrame: 828 862 400 135 0 0 2056 1285
    • NSWindow Frame SUUpdateAlert: 718 665 620 398 0 0 2056 1285
    • SUHasLaunchedBefore: 1
    • SULastCheckTime: 2024-12-15 10:38:15 +0000
    • SUUpdateGroupIdentifier: 2750686940
    • SUUpdateRelaunchingMarker: 0
    • alignThumbnails: 0
    • appearanceSize: 0
    • appearanceStyle: 1
    • appsToShow: 0
    • fontHeight: 14
    • hideAppBadges: true
    • hideSpaceNumberLabels: true
    • hideStatusIcons: true
    • hideThumbnails: true
    • hideWindowlessApps: true
    • holdShortcut: ⌘
    • iconSize: 40
    • menubarIcon: 0
    • menubarIconShown: false
    • preferencesVersion: 7.12.0
    • previousWindowShortcut: ⇧⇥
    • screenRecordingPermissionSkipped: true
    • screensToShow: 0
    • showMinimizedWindows: 0
    • showOnScreen: 1
    • showTabsAsWindows: false
    • spacesToShow: 1
    • theme: 0
    • titleTruncation: 2
    • updatePolicy: 1
    • windowMaxWidthInRow: 7
    • windowMinWidthInRow: 7
  • Applications: 63
  • Windows: 13
    • {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: true, shouldShowTheUser: true, spaceId: 3, spaceIndex: 3}
    • {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: true, shouldShowTheUser: true, spaceId: 3, spaceIndex: 3}
    • {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 3, spaceIndex: 3}
    • {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 3, spaceIndex: 3}
    • {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: true, shouldShowTheUser: true, spaceId: 3, spaceIndex: 3}
    • {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: true, shouldShowTheUser: true, spaceId: 3, spaceIndex: 3}
    • {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: true, shouldShowTheUser: true, spaceId: 3, spaceIndex: 3}
    • {isFullscreen: false, isWindowlessApp: false, isMinimized: true, isHidden: false, isTabbed: false, isOnAllSpaces: true, shouldShowTheUser: true, spaceId: 3, spaceIndex: 3}
    • {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 3, spaceIndex: 3}
    • {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: true, shouldShowTheUser: true, spaceId: 3, spaceIndex: 3}
    • {isFullscreen: false, isWindowlessApp: false, isMinimized: true, isHidden: false, isTabbed: false, isOnAllSpaces: true, shouldShowTheUser: true, spaceId: 3, spaceIndex: 3}
    • {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 3, spaceIndex: 3}
    • {isFullscreen: false, isWindowlessApp: false, isMinimized: false, isHidden: false, isTabbed: false, isOnAllSpaces: false, shouldShowTheUser: true, spaceId: 3, spaceIndex: 3}
  • OS version: Version 15.2 (Build 24C101)
  • OS architecture: arm64
  • Locale: en_US (fixed en_US)
  • Spaces: 4
  • Dark mode: Dark
  • "Displays have separate Spaces": unchecked
  • Hardware model: Mac14,6
  • Screens: 1
    • {x: 0.0, y: 0.0, width: 2056.0, height: 1329.0}
  • CPU model: Apple M2 Max
  • Memory size: 34.36 GB
  • Active CPU count: 12
  • Current CPU frequency: nil
  • Resource utilization:
    • CPU: 0.5%
    • Memory: 185M+
    • Threads count: 13

@yarmoliq yarmoliq added the bug Something isn't working label Dec 16, 2024
@lwouis
Copy link
Owner

lwouis commented Dec 16, 2024

Hi,
Thank you for sharing this issue.
Could you please follow instructions from this message?
Thank you 🙇

@lwouis lwouis changed the title High CPU usage after recent update AltTab sometimes doesn't respond quickly; it has high CPU usage Dec 16, 2024
@lwouis lwouis added the unreproducible Need help from the author to reproduce the issue label Dec 16, 2024
@timothyvermeiren
Copy link

Hi All! Visiting from #3845, hopefully with relevant debug logs. I think was able to capture this as it happened, when I pressed CMD+tab at 11:41:05.

Attached are the logs from that timeframe:

  • A few lines from before.
  • The lines from when the freeze occurred, notably with a gap between 11:41:05 stating handleKeyboardEvent() and 11:41:11.
  • I think that like most people I pressed CMD+tab a number of times as a reaction to AltTab not showing, which probably explains the rather large number of handleKeyboardEvent() repetitions all at 11:41:14 which is probably when the app un-froze.

Happy to provide more details if I can.

AltTab-debug.log

@lwouis
Copy link
Owner

lwouis commented Dec 16, 2024

Thank you @timothyvermeiren

It's hard to follow the logs without knowing exactly what you did at the same time, and what you saw as well.

You mentioned a lack of logs between 11:41:05 and 11:41:11. At 11:41:05, we see the option key down, I think. Without tab being pressed. At 11:41:11, we see alt+tab are down, thus it triggers. It looks like normal behavior here. I don't know what you pressed though.

In the logs, we see a lot of showUiOrCycleSelection() -> focusTarget() -> hideUi(). Looking at the code, it seems that you may have ended up in checkForFingersUp() which triggers focusTarget when the 3 fingers are released from the trackpad. Do you use the Trackpad (Preferences > Controls > Gesture tab)?

Thank you

@lwouis
Copy link
Owner

lwouis commented Dec 16, 2024

For everyone: please share a video with the logs. It will help a lot understand the sequence, and read the logs.

@yarmoliq
Copy link
Author

yarmoliq commented Dec 16, 2024

It takes a while for it to unfreez if I don't switch windows for a minute or 2. Once I press it, there is no response for 2-10 seconds. Then a window finally switches. It doesn't matter if I press command tab once or if I press it continuously until it responds. Also, once it does respond, it doesn't matter how fast I press command tab, cpu utilization doesn't rise at all. It only happens when it is frozen.

Do you use the Trackpad (Preferences > Controls > Gesture tab)?

I'm not sure what is that. I don't use trackpad to switch between windows at all. Occasionally to switch between virtual desktops

@timothyvermeiren
Copy link

Thank you @timothyvermeiren

It's hard to follow the logs without knowing exactly what you did at the same time, and what you saw as well.

You mentioned a lack of logs between 11:41:05 and 11:41:11. At 11:41:05, we see the option key down, I think. Without tab being pressed. At 11:41:11, we see alt+tab are down, thus it triggers. It looks like normal behavior here. I don't know what you pressed though.

In the logs, we see a lot of showUiOrCycleSelection() -> focusTarget() -> hideUi(). Looking at the code, it seems that you may have ended up in checkForFingersUp() which triggers focusTarget when the 3 fingers are released from the trackpad. Do you use the Trackpad (Preferences > Controls > Gesture tab)?

Thank you

Hello again, @lwouis.

I don't have a video that goes with that specific log entry, but I can tell you what happened. I checked the time, to the second, before I pressed the shortcut that I have assigned to AltTab: CMD + tab. It was 11:41:05, without a doubt.

That's why I am noting the lack of logs specifically. I realize the logs make it seem like a different shortcut was pressed; possibly the option key when my finger slipped on it?

As for the trackpad gestures: I don't think I am using that. In fact, it doesn't seem to be available on the version (7.8.0) I have now:

CleanShot 2024-12-17 at 06 09 48

Regarding the video: I can't promise anything. I realize it would be easier, but it's tough to record your (very large) screen all the time while working on several things, having client calls, etc.

@yarmoliq
Copy link
Author

yarmoliq commented Dec 17, 2024

maybe it has something to do with the recent macos 15.2 update?

@deepaktalwardt
Copy link

I'm having the exact same issue. AltTab spikes up CPU usage, holds it up for up to 10 seconds at a time. During this time I experience lags with scrolling etc; and Cmd+Tab doesn't show the AltTab switcher UI. It then hangs and window only switches after a few seconds.

I'm on MacOS 15.2 as well - although I have experienced this on and off in earlier MacOS versions as well. It seems to have gotten worse now.

My guess is that it might have something to do with the screen capture requirement for getting previews, but I could be wrong.

image

@lwouis
Copy link
Owner

lwouis commented Dec 17, 2024

Could you please share a spindump when the app is high CPU and unresponsive? You can generate one via Activity Monitor.
Thank you

@Duc-NSH
Copy link

Duc-NSH commented Dec 18, 2024

I do not have the high CPU usage issue, but it is really delayed when I try to use the mouse to hover too fast among windows, the delay can be up to 2 seconds

@Duc-NSH
Copy link

Duc-NSH commented Dec 18, 2024

tried to revert the version to 7.9.0, but the issue remains, I doubt that there the MacOS 15.2 did something to alt-tab

@morhekil
Copy link

I'm seeing the same problem on 14.6.1. AltTab sometimes doesn't respond to keystrokes, and its menu bar icon just shows a spinner when hovered. It unfreezes by itself after 10 seconds or so. I started seeing this only recently, so seems to be related to one of the more recent AltTab releases.

@lwouis
Copy link
Owner

lwouis commented Dec 18, 2024

Thank you everyone for sharing your story.

If we want progress on this, we need data. As it is, I have nothing to investigate.

if you can, please share a video of the issue. Also please share a spindump, as well as the logs.

Thank you

@yarmoliq
Copy link
Author

yarmoliq commented Dec 18, 2024

how do i make a spindump? and where do i find the logs?
also, i have previews turned off, so it probably has nothing to do with that

@lwouis
Copy link
Owner

lwouis commented Dec 18, 2024

how do i make a spindump?

Click here in Activity Monitor, while AltTab is selected in the list of processes:

image

where do i find the logs?

Please run AltTab from Terminal.app by running this command: AltTab.app/Contents/MacOS/AltTab --logs=debug. Then share the logs which print when AltTab is unresponsive. A bit before if possible.

A video would also help, so it's easier to match behavior and logs

Thank you

@yarmoliq
Copy link
Author

i will do that. where will the logs be?

@lwouis
Copy link
Owner

lwouis commented Dec 18, 2024

In Terminal.app, right bellow the command you'll enter

@deepaktalwardt
Copy link

Could you please share a spindump when the app is high CPU and unresponsive? You can generate one via Activity Monitor. Thank you

I just sampled the AltTab process as it spun up to high CPU usage again. What's the best way to share it?

@lwouis
Copy link
Owner

lwouis commented Dec 18, 2024

Please share the file here directly. You can attach it to your comment

@deepaktalwardt
Copy link

Please share the file here directly. You can attach it to your comment

Sample of AltTab.txt

@elliottower
Copy link

I created #4008 through the app, sorry didn't check the issues. Commenting here in case it's fixed. Pretty bad experience right now, may have to use stock apple alt tab behavior until it's fixed

@morhekil
Copy link

just as another point of reference – I downgraded AltTab to 7.0.0, and it seems that the problem is gone now, I'm not getting any frequent freezes anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unreproducible Need help from the author to reproduce the issue
Projects
None yet
Development

No branches or pull requests

7 participants