ActivityWatch / ActivityWatch/activitywatch

aw-server randomly crashes on start up (WinError 10013)

オープン
#571 コメント 7 件 リアクション 1 件 担当者 0 名 GitHub で見る
type: bug
主要言語
Python
スター
18.9k
フォーク
1k
平均マージ
1日 4時間
マージ済み PR(30日)
28

説明

- [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**: Windows 10 2004 Build 19041.804 (System language: DE)
- **ActivityWatch version**: 0.10.0

## Describe the bug
Randomly, the aw-server fails to launch and keeps crashing whether the module is restarted or the program is completely shutdown using the "Quit ActivityWatch" button in tray icon menu and restarted. This doesn't always happen: sometimes the program runs smoothly over the course of multiple restarts, other times it repeatedly crashes even after restarting the computer.
The resulting error is always WinError 10013.

## To Reproduce
I haven't tested enough to reliably reproduce this error.

## Expected behavior
The program should start up correctly on every system start.

## Documentation
![image](https://user-images.githubusercontent.com/27809595/109428127-e3291180-79f5-11eb-9c3b-7c2baaffac4a.png)
```
2021-02-28 17:48:02 [INFO ]: Using storage method: peewee (aw_server.main:26)
2021-02-28 17:48:02 [INFO ]: Starting up... (aw_server.main:31)
2021-02-28 17:48:02 [INFO ]: Using database file: C:\Users\macbr\AppData\Local\activitywatch\activitywatch\aw-server\peewee-sqlite.v2.db (aw_datastore.storages.peewee:116)
2021-02-28 17:48:02 [ERROR]: [WinError 10013] Der Zugriff auf einen Socket war aufgrund der Zugriffsrechte des Sockets unzulässig (aw_server.server:93)
2021-02-28 17:48:02 [ERROR]: Unhandled exception (root:43)
Traceback (most recent call last):
File "__main__.py", line 3, in
File "aw_server\main.py", line 33, in main
File "aw_server\server.py", line 94, in _start
File "aw_server\server.py", line 91, in _start
File "lib\site-packages\flask\app.py", line 990, in run
File "lib\site-packages\werkzeug\serving.py", line 1012, in run_simple
File "lib\site-packages\werkzeug\serving.py", line 965, in inner
File "lib\site-packages\werkzeug\serving.py", line 823, in make_server
File "lib\site-packages\werkzeug\serving.py", line 701, in __init__
File "socketserver.py", line 452, in __init__
File "http\server.py", line 137, in server_bind
File "socketserver.py", line 466, in server_bind
OSError: [WinError 10013] Der Zugriff auf einen Socket war aufgrund der Zugriffsrechte des Sockets unzulässig
```
Screenshot of the log folder: all 2kb files are erroring start-up attempts
![image](https://user-images.githubusercontent.com/27809595/109428428-67c85f80-79f7-11eb-83e9-f184f60b0b52.png)

Programs trying to send data to port 5600 during startup:
```powershell
PS C:\Users\macbr> Get-NetTCPConnection |where {($_.RemotePort -eq 5600)} |Foreach {(Get-Process -Id $_.OwningProcess)}
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
215 20 18280 27432 0,52 12612 1 aw-watcher-afk
259 26 20904 34924 19,45 12664 1 aw-watcher-window
```
Trying to query programs listening on port 5600 yielded no results.

## Additional context

aw-qt_2021-02-28T18-53-35.log
```
2021-02-28 18:53:35 [INFO ]: Searching for bundled modules in: ['C:\\Users\\macbr\\AppData\\Local\\Programs\\ActivityWatch\\aw_qt', 'C:\\Users\\macbr\\AppData\\Local\\Programs\\ActivityWatch'] (aw_qt.manager:67)
2021-02-28 18:53:35 [WARNING]: Found matching file but was not executable: C:\Users\macbr\AppData\Local\Programs\ActivityWatch\aw-qt.desktop (aw_qt.manager:55)
2021-02-28 18:53:35 [WARNING]: Found matching file but was not executable: C:\Users\macbr\AppData\Local\Programs\ActivityWatch\aw-qt.exe.manifest (aw_qt.manager:55)
2021-02-28 18:53:35 [WARNING]: Found matching file but was not executable: C:\Users\macbr\AppData\Local\Programs\ActivityWatch\aw-server\aw-server.exe.manifest (aw_qt.manager:55)
2021-02-28 18:53:35 [WARNING]: Found matching file but was not executable: C:\Users\macbr\AppData\Local\Programs\ActivityWatch\aw-server-rust\aw-server.service (aw_qt.manager:55)
2021-02-28 18:53:35 [WARNING]: Found matching file but was not executable: C:\Users\macbr\AppData\Local\Programs\ActivityWatch\aw-watcher-afk\aw-watcher-afk.exe.manifest (aw_qt.manager:55)
2021-02-28 18:53:35 [WARNING]: Found matching file but was not executable: C:\Users\macbr\AppData\Local\Programs\ActivityWatch\aw-watcher-window\aw-watcher-window.exe.manifest (aw_qt.manager:55)
2021-02-28 18:53:35 [INFO ]: Found bundled modules: (aw_qt.manager:72)
2021-02-28 18:53:35 [INFO ]: - aw-qt at C:\Users\macbr\AppData\Local\Programs\ActivityWatch\aw-qt.exe (aw_qt.manager:24)
2021-02-28 18:53:35 [INFO ]: - aw-server at C:\Users\macbr\AppData\Local\Programs\ActivityWatch\aw-server\aw-server.exe (aw_qt.manager:24)
2021-02-28 18:53:35 [INFO ]: - aw-server-rust at C:\Users\macbr\AppData\Local\Programs\ActivityWatch\aw-server-rust\aw-server-rust.exe (aw_qt.manager:24)
2021-02-28 18:53:35 [INFO ]: - aw-watcher-afk at C:\Users\macbr\AppData\Local\Programs\ActivityWatch\aw-watcher-afk\aw-watcher-afk.exe (aw_qt.manager:24)
2021-02-28 18:53:35 [INFO ]: - aw-watcher-window at C:\Users\macbr\AppData\Local\Programs\ActivityWatch\aw-watcher-window\aw-watcher-window.exe (aw_qt.manager:24)
2021-02-28 18:53:35 [INFO ]: Found system modules: (aw_qt.manager:99)
2021-02-28 18:53:35 [INFO ]: Starting module aw-server (aw_qt.manager:128)
2021-02-28 18:53:35 [INFO ]: Starting module aw-watcher-afk (aw_qt.manager:128)
2021-02-28 18:53:35 [INFO ]: Starting module aw-watcher-window (aw_qt.manager:128)
2021-02-28 18:53:35 [INFO ]: Creating trayicon... (aw_qt.trayicon:200)
2021-02-28 18:53:35 [INFO ]: Initialized aw-qt and trayicon succesfully (aw_qt.trayicon:235)
2021-02-28 18:53:38 [WARNING]: Tried to stop module aw-server, but it wasn't running (aw_qt.manager:171)
```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start with aw_server/server.py at the startup path shown in the traceback, then review the aw_qt.manager startup and stop messages. Reproduce on Windows with the bundled modules and port 5600 while checking whether another process or startup race prevents binding. Done means aw-server starts reliably without WinError 10013.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
flask, python
領域
backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。