activitywatch icon indicating copy to clipboard operation
activitywatch copied to clipboard

aw-watcher-windows: Broken pipe

Open ivanpondal opened this issue 2 years ago • 3 comments

  • [x] I am on the latest ActivityWatch version.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • OS name and version: Fedora 36
  • ActivityWatch version: 0.11.0

Describe the bug

aw-watcher-windows crashed and stopped reporting metrics.

To Reproduce

Have not tried reproducing it yet.

Expected behavior

Ideally, aw-watcher-windows should restart. Maybe have a systemd unit config or similar.

Documentation

aw-watcher-window logs:

2022-07-06 15:34:20 [INFO ]: aw-watcher-window started  (aw_watcher_window.main:51)
2022-07-06 15:34:21 [INFO ]: Connection to aw-server established by aw-watcher-window  (aw_client.client:417)
2022-07-06 15:45:34 [ERROR]: Exception thrown while trying to get active window: Display connection closed by server: [Errno 32] Broken pipe  (aw_watcher_window.main:74)
2022-07-06 15:45:34 [ERROR]: Unhandled exception  (root:43)
Traceback (most recent call last):
  File "Xlib/protocol/display.py", line 583, in send_and_recv
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "aw_watcher_window/main.py", line 71, in heartbeat_loop
  File "aw_watcher_window/lib.py", line 53, in get_current_window
  File "aw_watcher_window/lib.py", line 8, in get_current_window_linux
  File "aw_watcher_window/xlib.py", line 37, in get_current_window
  File "aw_watcher_window/xlib.py", line 20, in _get_current_window_id
  File "Xlib/xobject/drawable.py", line 472, in get_full_property
  File "Xlib/xobject/drawable.py", line 455, in get_property
  File "Xlib/protocol/rq.py", line 1369, in __init__
  File "Xlib/protocol/rq.py", line 1381, in reply
  File "Xlib/protocol/display.py", line 586, in send_and_recv
Xlib.error.ConnectionClosedError: Display connection closed by server: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "aw_watcher_window/__main__.py", line 3, in <module>
  File "aw_watcher_window/main.py", line 55, in main
  File "aw_watcher_window/main.py", line 77, in heartbeat_loop
  File "traceback.py", line 163, in print_exc
  File "traceback.py", line 105, in print_exception
OSError: [Errno 5] Input/output error
2022-07-06 15:45:34 [ERROR]: Unhandled exception  (root:43)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
OSError: [Errno 5] Input/output error

ivanpondal avatar Jul 06 '22 20:07 ivanpondal

Hi there! As you're new to this repo, please make sure you've used an appropriate issue template and searched for duplicates (it helps us focus on actual development!). We'd also like to suggest that you read our contribution guidelines and our code of conduct. Thanks a bunch for opening your first issue! 🙏

github-actions[bot] avatar Jul 06 '22 20:07 github-actions[bot]

Will add information if I'm able to reproduce it.

ivanpondal avatar Jul 06 '22 20:07 ivanpondal

This is probably (indirectly) caused by https://github.com/ActivityWatch/aw-qt/issues/49

ErikBjare avatar Jul 07 '22 13:07 ErikBjare

I met the same problem. But this is crazy.

image

➜ wc --lines aw-watcher-window_2022-09-30T15-17-22.log
1122329536 aw-watcher-window_2022-09-30T15-17-22.log

asukaminato0721 avatar Oct 04 '22 09:10 asukaminato0721

@wuyudi Holy moly. Sorry about that.

PRs welcome! (I'm afraid I'll keep procrastinating on this otherwise)

ErikBjare avatar Oct 04 '22 13:10 ErikBjare

The following PRs should make sure this never happens again:

  • Rotating logfiles with max size: https://github.com/ActivityWatch/aw-core/pull/114
  • Handle the errors better: https://github.com/ActivityWatch/aw-watcher-window/pull/73

Thanks for reporting @ivanpondal & @wuyudi!

ErikBjare avatar Oct 26 '22 14:10 ErikBjare