Skip to content

[macos] Process crashes with Unexpectedly found nil while unwrapping an Optional value #100

@DanielMe

Description

@DanielMe

I see the aw-watcher-window process randomly crashing on MacOS after a while. I cannot quite determine what triggers the crash.

Here is the output of the process with --verbose:

$ /Applications/ActivityWatch.app/Contents/MacOS/aw-watcher-window --verbose
2024-02-13 14:00:53 [DEBUG]: SingleInstance lockfile: /Users/dmesch/Library/Caches/activitywatch/client_locks/aw-watcher-window-at-127.0.0.1-on-5600  (aw_client.singleinstance:22)
2024-02-13 14:00:53 [DEBUG]: queue path '/Users/dmesch/Library/Application Support/activitywatch/aw-client/queued/aw-watcher-window.v1.persistqueue'  (aw_client.client:407)
2024-02-13 14:00:53 [INFO ]: aw-watcher-window started  (aw_watcher_window.main:62)
usage: aw-watcher-window [-h] [--host HOST] [--port PORT] [--testing] [--exclude-title] [--verbose] [--poll-time POLL_TIME] [--strategy {jxa,applescript,swift}]
aw-watcher-window: error: unrecognized arguments: -B -S -E -s -c from multiprocessing.resource_tracker import main;main(6)
usage: aw-watcher-window [-h] [--host HOST] [--port PORT] [--testing] [--exclude-title] [--verbose] [--poll-time POLL_TIME] [--strategy {jxa,applescript,swift}]
aw-watcher-window: error: unrecognized arguments: --multiprocessing-fork tracker_fd=7 pipe_handle=9
2024-02-13 14:00:54 [INFO ]: Using swift strategy, calling out to swift binary  (aw_watcher_window.main:67)
2024-02-13 14:00:54 [DEBUG]: Starting new HTTP connection (1): 127.0.0.1:5600  (urllib3.connectionpool:228)
2024-02-13 14:00:54 [DEBUG]: http://127.0.0.1:5600 "POST /api/0/buckets/aw-watcher-window_98dd605457bd.ant.amazon.com HTTP/1.1" 304 0  (urllib3.connectionpool:456)
2024-02-13 14:00:54 [INFO ]: Connection to aw-server established by aw-watcher-window  (aw_client.client:436)
2024-02-13 14:01:15 [aw-watcher-window-macos] [INFO] Failed to create bucket
main/macos.swift:282: Fatal error: Unexpectedly found nil while unwrapping an Optional value
2024-02-13 16:59:45 [DEBUG]: queue path '/Users/dmesch/Library/Application Support/activitywatch/aw-client/queued/aw-watcher-window.v1.persistqueue'  (aw_client.client:407)

Note the exception main/macos.swift:282: Fatal error: Unexpectedly found nil while unwrapping an Optional value.

Looking at the code location, I am not on the same version as the master branch. I am using the version bundled with ActivityWatch version v0.12.2.

This line could be a candidate:
https://github.com/ActivityWatch/aw-watcher-window/blob/f08afe80cc3af1c62f948abb015be0ad3adcec67/aw_watcher_window/macos.swift#L282C1-L282C55

In that case the issue would be fixed with 82d9673

Does the .dmg package on https://activitywatch.net/ potentially contain an old version?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions