ActivityWatch / activitywatch

The best free and open-source automated time tracker. Cross-platform, extensible, privacy-focused.
https://activitywatch.net/
Mozilla Public License 2.0
12.69k stars 565 forks source link

Watchers and the server run twice in the Process table #447

Closed nicolae-stroncea closed 4 years ago

nicolae-stroncea commented 4 years ago

Describe the bug

  1. Launch each server and watcher
    ~/activitywatch/aw-server/./aw-server &
    ~/activitywatch/aw-watcher-afk/./aw-watcher-afk &
    ~/activitywatch/aw-watcher-window/./aw-watcher-window &
  2. Execute ps aux | grep aw-
  3. Output
    nicolae     3772  0.0  0.0   2556   628 ?        S    00:00   0:00 /home/nicolae/Software/activitywatch/aw-server/./aw-server
    nicolae     3773  0.0  0.0   2556   628 ?        S    00:00   0:00 /home/nicolae/Software/activitywatch/aw-watcher-afk/./aw-watcher-afk
    nicolae     3774  0.0  0.0   2556   628 ?        S    00:00   0:00 /home/nicolae/Software/activitywatch/aw-watcher-window/./aw-watcher-window
    nicolae     3782  0.5  0.1 389076 28016 ?        Sl   00:00   0:11 /home/nicolae/Software/activitywatch/aw-watcher-window/./aw-watcher-window
    nicolae     3784 48.3  0.3 353228 58020 ?        S    00:00  16:48 /home/nicolae/Software/activitywatch/aw-server/./aw-server
    nicolae     3789  1.6  0.1 538260 31060 ?        Sl   00:00   0:34 /home/nicolae/Software/activitywatch/aw-watcher-afk/./aw-watcher-afk

Is this expected behaviour or are the processes duplicated for some reason?

Events are being stored normally in the database, but that is expected as even if they were sent twice, they would be merged together due to heartbeats.

Note: If I launch aw-server-rust, aw-server-rust will run in 1 single process, however the watchers will still take 2 processes each

johan-bjareholt commented 4 years ago

This is because of how PyInstaller works, run it from source and you will see that it will only be one process.

See the following link for more information: https://stackoverflow.com/questions/33405338/how-to-eliminate-two-instances-of-exe-compiled-by-pyinstaller