ActivityWatch / ActivityWatch/activitywatch

Mac OS Menu Bar Button Crashes aw-qt

Đang mở
#1,324 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
type: bug
Ngôn ngữ chính
Python
Star
18.9k
Fork
1k
Merge trung bình
1 ngày 4 giờ
Pull request đã merge (30 ngày)
28

Mô tả

* **OS name and version**: macOS 27.0 beta, build 26A5353q

* **ActivityWatch version**: v0.13.2

## Describe the bug

On macOS 27.0 beta, clicking the ActivityWatch menu bar icon crashes `aw-qt`.

When `aw-qt` crashes, `aw-watcher-afk` exits with:

```text
afkwatcher stopped because parent process died
```

After this, `aw-server` and `aw-watcher-window` continue running, and `aw-watcher-window` continues producing current window events. However, `aw-watcher-afk` no longer produces AFK events.

This leaves ActivityWatch with current `currentwindow` data but stale `afkstatus` data.

## To Reproduce

1. Launch `ActivityWatch.app`.

2. Confirm that `aw-qt`, `aw-server`, `aw-watcher-window`, and `aw-watcher-afk` are running.

3. Click the ActivityWatch menu bar icon.

4. The menu bar icon disappears.

5. `aw-qt` exits/crashes.

6. `aw-watcher-afk` exits with:

```text
afkwatcher stopped because parent process died
```

7. `aw-server` and `aw-watcher-window` remain running.

After reproduction, process state looked like this:

```text
/Applications/ActivityWatch.app/Contents/MacOS/aw-server
/Applications/ActivityWatch.app/Contents/MacOS/aw-watcher-window
/Applications/ActivityWatch.app/Contents/Frameworks/aw_watcher_window/aw-watcher-window-macos http://127.0.0.1:5600 aw-watcher-window_BergBook-Air.local BergBook-Air.local aw-watcher-window
```

No `aw-qt` and no `aw-watcher-afk` processes were running.

## Expected behavior

Clicking the ActivityWatch menu bar icon should open the ActivityWatch menu and should not crash `aw-qt`.

Also, if `aw-qt` exits or crashes, ActivityWatch should either keep the default watchers alive, restart them, or visibly report that they stopped. In particular, `aw-watcher-afk` should not silently stop producing `afkstatus` events.

## Logs and crash report

Relevant `aw-qt` log:

```text
2026-06-22 15:04:51 [INFO ]: Started aw-qt... (aw_qt.main:53)
2026-06-22 15:04:52 [INFO ]: Found 7 bundled modules (aw_qt.manager:85)
2026-06-22 15:04:52 [INFO ]: Found 0 system modules (aw_qt.manager:119)
2026-06-22 15:04:52 [INFO ]: Starting module aw-server (aw_qt.manager:148)
2026-06-22 15:04:52 [INFO ]: Starting module aw-watcher-afk (aw_qt.manager:148)
2026-06-22 15:04:52 [INFO ]: Starting module aw-watcher-window (aw_qt.manager:148)
2026-06-22 15:04:52 [INFO ]: Creating trayicon... (aw_qt.trayicon:208)
2026-06-22 15:04:53 [INFO ]: Initialized aw-qt and trayicon successfully (aw_qt.trayicon:264)
2026-06-22 15:04:55 [WARNING]: Tried to stop module aw-watcher-window, but it wasn't running (aw_qt.manager:185)
2026-06-22 15:04:55 [WARNING]: Tried to stop module aw-server, but it wasn't running (aw_qt.manager:185)
```

Relevant `aw-watcher-afk` log:

```text
2026-06-22 15:04:53 [INFO ]: aw-watcher-afk started (aw_watcher_afk.afk:62)
2026-06-22 15:04:54 [INFO ]: Connection to aw-server established by aw-watcher-afk (aw_client.client:447)
2026-06-22 15:26:05 [INFO ]: afkwatcher stopped because parent process died (aw_watcher_afk.afk:82)
```

A new macOS crash report was created at the same time:

```text
~/Library/Logs/DiagnosticReports/aw-qt-2026-06-22-152605.ips
```

Crash report summary:

```text
app_name: aw-qt
timestamp: 2026-06-22 15:26:05.00 -0400
app_version: 0.13.2
bundleID: net.activitywatch.ActivityWatch
os_version: macOS 27.0 (26A5353q)
procPath: /Applications/ActivityWatch.app/Contents/MacOS/aw-qt
translated: true
cpuType: X86-64
parentProc: launchd
sip: enabled
exception: EXC_BAD_ACCESS / SIGSEGV
subtype: KERN_INVALID_ADDRESS, possible pointer authentication failure
termination: Segmentation fault: 11
```

Relevant stack frames from the crash report:

```text
-[NSEvent clickCount]
-[NSMenuTrackingSession sendBeginTrackingNotifications]
-[NSMenuTrackingSession beginTrackingSession:]
+[NSContextMenuImpl presentPopup:fromView:withContext:animated:async:completionBlock:]
_NSPopUpMenu
-[NSStatusBarButtonCell popUpStatusBarMenu:ofItem:ofBar:inRect:ofView:withEvent:]
-[NSStatusItem popUpStatusItemMenu:]
-[NSStatusItem _beginExpandedInterfaceSession:]
-[NSSceneStatusItem _beginExpandedInterfaceSession:]
-[NSApplication run]
QEventLoop::exec(QFlags)
QCoreApplication::exec()
meth_QApplication_exec(_object*, _object*)
```

Historical `aw-watcher-afk` logs show the same parent-death pattern on earlier launches:

```text
2026-06-16 20:00:03 [INFO ]: afkwatcher stopped because parent process died
2026-06-18 18:00:59 [INFO ]: afkwatcher stopped because parent process died
2026-06-18 18:01:47 [INFO ]: afkwatcher stopped because parent process died
2026-06-18 18:02:00 [INFO ]: afkwatcher stopped because parent process died
2026-06-20 13:06:02 [INFO ]: afkwatcher stopped because parent process died
2026-06-22 14:54:23 [INFO ]: afkwatcher stopped because parent process died
2026-06-22 15:26:05 [INFO ]: afkwatcher stopped because parent process died
```

## Additional context

This is on an Apple Silicon Mac. The ActivityWatch crash report shows `translated: true`, so ActivityWatch v0.13.2 is running as `x86_64` under Rosetta.

This appears to be an `aw-qt` menu bar/status item crash rather than an AFK input-permission problem. `aw-watcher-afk` can start, connect to `aw-server`, and write AFK events until `aw-qt` crashes.

Observed bucket behavior after the crash:

```text
aw-watcher-window_.local continues updating
aw-watcher-afk_.local stops updating
```

I did not find ActivityWatch logs indicating an Input Monitoring, Accessibility, or TCC permission denial.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.