ActivityWatch / ActivityWatch/activitywatch

aw-watcher-window randomly crashes on swift strategy

Abierto
#986 13 comentarios 0 reacciones 0 asignados Ver en GitHub
stale type: bug
Lenguaje dominante
Python
Estrellas
18.9k
Forks
1k
Merge medio
1 d 4 h
PR fusionados (30 d)
28

Descripción

- [x] I am on the [latest](https://github.com/ActivityWatch/activitywatch/releases/latest) ActivityWatch version.
- [x] I have searched the issues of this repo and believe that this is not a duplicate.

- **OS name and version**: macOS Sonoma 14.0
- **ActivityWatch version**: 0.12.2

## Describe the bug

aw-watcher-window seems to be crashing at random intervals with no logs when run normally with swift strategy.

I tried running the watcher via terminal and different strategy (both jxa and applescript) and both seemed to work with no issues. I was not able, however, to run the watcher with different strategy via the menu bar.

It can easily get annoying when you don't receive a GUI error message on crash and thus have to constantly check whether the watcher is actually still running.

## To Reproduce
Not sure how to consistently reproduce this issue. Sometimes the watcher can run for a few hours with no crashes just to crash 3 times in the next 10 minutes.

## Expected behavior

aw-watcher-window to work all the time.

## Documentation

Logs when the watcher is run via terminal with verbose setting enabled:
```
/Applications/ActivityWatch.app/Contents/MacOS/aw-watcher-window --strategy swift --verbose
2023-11-02 20:56:05 [DEBUG]: SingleInstance lockfile: /Users/jaqobb/Library/Caches/activitywatch/client_locks/aw-watcher-window-at-127.0.0.1-on-5600 (aw_client.singleinstance:22)
2023-11-02 20:56:05 [DEBUG]: queue path '/Users/jaqobb/Library/Application Support/activitywatch/aw-client/queued/aw-watcher-window.v1.persistqueue' (aw_client.client:407)
2023-11-02 20:56:05 [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
2023-11-02 20:56:06 [INFO ]: Using swift strategy, calling out to swift binary (aw_watcher_window.main:67)
2023-11-02 20:56:06 [DEBUG]: Starting new HTTP connection (1): 127.0.0.1:5600 (urllib3.connectionpool:228)
2023-11-02 20:56:06 [DEBUG]: http://127.0.0.1:5600 "POST /api/0/buckets/aw-watcher-window_jaqobb-laptop.local HTTP/1.1" 304 0 (urllib3.connectionpool:456)
2023-11-02 20:56:06 [INFO ]: Connection to aw-server established by aw-watcher-window (aw_client.client:436)
2023-11-02 20:56:06 [aw-watcher-window-macos] [INFO] Failed to create bucket
main/macos.swift:282: Fatal error: Unexpectedly found nil while unwrapping an Optional value
2023-11-02 20:57:36 [DEBUG]: queue path '/Users/jaqobb/Library/Application Support/activitywatch/aw-client/queued/aw-watcher-window.v1.persistqueue' (aw_client.client:407)
```

My guess is that the crash happens because of the error in the second to last line.

## Additional context

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.