ActivityWatch / ActivityWatch/activitywatch
aw-server randomly crashes on start up (WinError 10013)
- Lingua principale
- Python
- Stelle
- 18.9k
- Fork
- 1k
- Merge medio
- 1g 4h
- PR unite (30g)
- 28
Descrizione
- [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

```
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

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)
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- flask, python
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100