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

Freezing with high CPU usage on Apple Silicon (M1/M2) #3876

Open
bjorn opened this issue Jan 19, 2024 · 5 comments
Open

Freezing with high CPU usage on Apple Silicon (M1/M2) #3876

bjorn opened this issue Jan 19, 2024 · 5 comments
Labels
bug Broken behavior. help wanted Issues I'd love for somebody else to help out with! macos macOS specific issue.

Comments

@bjorn
Copy link
Member

bjorn commented Jan 19, 2024

Since a long time many different people are reporting issues running Tiled on their M1 / M2 Macs, most frequently on this forum thread.

I hoped a Universal build that included native ARM64 support would help with the issue, but that shipped with Tiled 1.10.2 and the problem is still being reported.

Describe the bug

Various quotes from the above forum thread:

I installed Tiled 1.10, 1.9 and 1.8 and all versions have the same problem. Tiled is randomly stuck loading. I use an older Macbook Pro 2015 but with Monterey installed.

The latest version freezes randomly. High CPU usage.

I’m using mac (M1 chip) ,OS Sonoma 14.2.1, I tried using older versions of Tiled as well. Current issue is that I get the spinning wheel of death, this happens after a minute of using the App. This causes the app to freeze and I have to close it out and restart it. It always crashes after the same amount of time.

To Reproduce

So far this problem has only been reported on M1 / M2 hardware, which is likely necessary to reproduce the problem. I don't have access to such hardware myself.

Tiled Version: Reportedly happened also with 1.7.2 (possibly earlier) and up to 1.10.2

How to Help

If you can reproduce this issue on your macOS system, please try to set up a Qt development environment by installing Qt and Xcode, then see if you can also reproduce the issue with your own build of Tiled. If it happens, it could help to run Tiled in the debugger and pause it, to see where it is getting stuck.

@bjorn bjorn added bug Broken behavior. macos macOS specific issue. help wanted Issues I'd love for somebody else to help out with! labels Jan 19, 2024
@raishey
Copy link

raishey commented Feb 7, 2024

I got this to work by downloading source to my m2 Mac and compiling under qt.

The file dialogs all pause when opening but become responsive within a couple seconds. Probably something there just haven’t had time to look yet.

I wonder if the author has access to a Mac m[n] environment or access to GitHub actions to handle the binary compile?

Hats off to the developer for having a super clear readme file allowing me to easily build it.

Let me know if/how I can help @bjorn

@raishey
Copy link

raishey commented Feb 7, 2024

I also notice that having a map open and opening another one results in the following out of range exception when running on my m2 (I don't have an M1 -I assume it's the same). It happens with 1.10.2 and 1.10.1.

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndexedSubscript:]: index 0 beyond bounds for empty array'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000018e3e0570 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x000000018ded1eb4 objc_exception_throw + 60
	2   CoreFoundation                      0x000000018e356d10 -[__NSCFString hasSuffix:] + 0
	3   libqcocoa.dylib                     0x0000000102fe656c -[QMacAccessibilityElement initWithId:role:] + 296
	4   libqcocoa.dylib                     0x0000000102fe65ec +[QMacAccessibilityElement elementWithId:] + 64
	5   libqcocoa.dylib                     0x0000000102fe4b88 _ZN19QCocoaAccessibility25notifyAccessibilityUpdateEP16QAccessibleEvent + 104
	6   QtWidgets                           0x000000010561a888 _ZN9QListView16selectionChangedERK14QItemSelectionS2_ + 204
	7   QtCore                              0x0000000103bf8b00 _Z10doActivateILb0EEvP7QObjectiPPv + 1248
	8   QtCore                              0x0000000103d5aa74 _ZN19QItemSelectionModel20emitSelectionChangedERK14QItemSelectionS2_ + 792
	9   QtCore                              0x0000000103d5a5f8 _ZN19QItemSelectionModel6selectERK14QItemSelection6QFlagsINS_13SelectionFlagEE + 368
	10  QtCore                              0x0000000103d5a45c _ZN19QItemSelectionModel6selectERK11QModelIndex6QFlagsINS_13SelectionFlagEE + 60
	11  QtCore                              0x0000000103d5ae60 _ZN19QItemSelectionModel15setCurrentIndexERK11QModelIndex6QFlagsINS_13SelectionFlagEE + 212
	12  QtWidgets                           0x00000001054ac2e8 _ZN16QComboBoxPrivate15setCurrentIndexERK11QModelIndex + 612
	13  QtWidgets                           0x00000001054abb5c _ZN9QComboBox15setCurrentIndexEi + 112
	14  QtWidgets                           0x00000001054af038 _ZN16QComboBoxPrivate12rowsInsertedERK11QModelIndexii + 344
	15  QtCore                              0x0000000103bf88f8 _Z10doActivateILb0EEvP7QObjectiPPv + 728
	16  QtCore                              0x0000000103d47ec4 _ZN18QAbstractItemModel13endInsertRowsEv + 160

@bjorn
Copy link
Member Author

bjorn commented Feb 7, 2024

I got this to work by downloading source to my m2 Mac and compiling under qt.

To make sure I understand this, do you mean you had this issue with the Tiled 1.10.2 release, so you've installed Qt and compiled Tiled yourself? And does the problem still happen for your own build?

I wonder if the author has access to a Mac m[n] environment or access to GitHub actions to handle the binary compile?

I don't have a physical M1 or M2. To see if I could reproduce this, I've recently rented an M1 Mac Mini at Scaleway, using VNC to access it. However, I had both the Tiled 1.10.2 release and a local build running there for a while and I could not reproduce the issue. :-(

I also notice that having a map open and opening another one results in the following out of range exception when running on my m2

Hmm, it could help to include the full call stack, because yours doesn't show which Tiled function is involved in this. However, it appears to be QTBUG-118585, which is marked as fixed in Qt 6.6.2, which isn't released yet. There are more accessibility released issues reportedly fixed in Qt 6.6.2, so when that release happens I think it could be a good time to make a new Tiled release against it.

@anders-n08
Copy link

Had the same issue (NSRangeException using Apple M2 hw). Recompiling using a Qt 6.8 snapshot has been super stable for me; hopefully the 6.6.2 includes the same fixes.

bjorn added a commit to bjorn/tiled-dev that referenced this issue Feb 16, 2024
Hopefully this addresses some issues on macOS (see mapeditor#3876).
@stoner-jack
Copy link

stoner-jack commented Apr 6, 2024

Hmm, it could help to include the full call stack, because yours doesn't show which Tiled function is involved in this. However, it appears to be QTBUG-118585, which is marked as fixed in Qt 6.6.2, which isn't released yet. There are more accessibility released issues reportedly fixed in Qt 6.6.2, so when that release happens I think it could be a good time to make a new Tiled release against it.

been testing with qt 6.6.2 on M1. The issue I had before was gone (was not able to open a map file) and it is so far so good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Broken behavior. help wanted Issues I'd love for somebody else to help out with! macos macOS specific issue.
Projects
None yet
Development

No branches or pull requests

4 participants