pharo-project / pharo

Pharo is a dynamic reflective pure object-oriented language supporting live programming inspired by Smalltalk.
http://pharo.org
Other
1.21k stars 355 forks source link

Mac WindowServer sometimes crashes when using Pharo #16454

Open Rinzwind opened 6 months ago

Rinzwind commented 6 months ago

A problem I’ve been having with Pharo for quite some time now is that the macOS WindowServer sometimes crashes when using it. The display first freezes and remains frozen for a while, except for the mouse pointer which can still be moved around. Then the display briefly turns black after which the macOS login screen appears. After logging in again, a crash report for WindowServer can be found in the Console app, saying it was a “watchdog-triggered termination event”. I have so far not found a way to consistently reproduce such a crash. But I have noticed that the following Terminal command shows that every window update in Pharo causes an entry “Invalid actual_host_time received from display” to be logged, which is likely related and doesn’t seem to happen when running other applications:

$ log stream --style compact --predicate 'eventMessage contains "Invalid actual_host_time received from display"'
Filtering the log data using "composedMessage CONTAINS "Invalid actual_host_time received from display""
Timestamp               Ty Process[PID:TID]
2024-04-14 21:40:52.668 E  WindowServer[183:36a] [com.apple.SkyLight:default] Invalid actual_host_time received from display: 0x4280f80  new time: 2093517201426 last time: 2093500529708
2024-04-14 21:40:52.702 E  WindowServer[183:36a] [com.apple.SkyLight:default] Invalid actual_host_time received from display: 0x4280f80  new time: 2093550534192 last time: 2093517201426
2024-04-14 21:40:52.786 E  WindowServer[183:36a] [com.apple.SkyLight:default] Invalid actual_host_time received from display: 0x4280f80  new time: 2093633860386 last time: 2093600532352
[…]

It would help to know whether others get such entries as well. I’m using a MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports) with macOS v13.6.6. The display is the built-in one.

For an actual crash, there are log entries like in the following, indicating the watchdog was informed of the display(s) being stuck:

$ log show --style compact --last 1h --predicate 'eventMessage matches ".*((has become stuck)|(Inform the watchdog)|(Window Server exited)).*"'
Filtering the log data using "composedMessage MATCHES ".*((has become stuck)|(Inform the watchdog)|(Window Server exited)).*""
Skipping info and debug messages, pass --info and/or --debug to include.
Timestamp               Ty Process[PID:TID]
2024-04-14 21:03:47.682 Df WindowServer[183:36b] [com.apple.SkyLight:watchdog] [ Watchdog ] display 4280f80 has become stuck after 10.00378s of unreadiness (2403 failures)
2024-04-14 21:03:47.682 Df WindowServer[183:36b] [com.apple.SkyLight:watchdog] [ Watchdog ] Inform the watchdog that all displays are stuck.
2024-04-14 21:04:26.508 Df loginwindow[187:3c0] [com.apple.loginwindow.logging:LWError] -[LoginApp windowServerExited] | ERROR | Window Server exited, closing down the session immediately
Rinzwind commented 6 months ago

Pharo version: Pharo 12 build 1474 with VM v10.1.1

I tried older versions as well. Pharo 8 build 1124 with VM version 202002121007 does not cause the logging of entries saying “Invalid actual_host_time received from display”. Pharo 9 build 1580 with VM v9.0.22 does cause such entries to be logged.

guillep commented 6 months ago

Just FYI, the biggest change there between Pharo 8 and Pharo 9 is the usage of SDL through FFI as a windowing system.