ActivityWatch / ActivityWatch/activitywatch

Gap of Negative Duration could NOT be Fixed - AW Server stuck in loop without exiting

Open
#1,125 20 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
Python
Stars
18.9k
Forks
1k
Avg merge
1d 4h
Merged PRs (30d)
28

Description

- [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**: Arch Linux x86_64
- **ActivityWatch version**: v0.13.2

## Describe the bug

Within one specific week I am getting:
```
2025-01-07 06:06:55 [WARNING]: Gap was of negative duration but could be safely merged (-165.163s). This message will only show once per batch. (aw_transform.flood:46)
2025-01-07 06:06:55 [WARNING]: Gap was of negative duration and could NOT be safely merged (-330.409s). This warning will only show once per batch. (aw_transform.flood:52)
```
the query will run out of time and the banner
`AxiosError: timeout of 90000ms exceeded. See dev console (F12) and/or server logs for more info.`
is displayed at the top of the webpage. However the activitywatch server will still continue to use 100% of one CPU core until manually stopped.

## To Reproduce

I start the server
![image](https://github.com/user-attachments/assets/2336bea8-d95e-4850-b2bd-8550f0737f36)
The server is running
![image](https://github.com/user-attachments/assets/94c56cfd-8e64-4f17-8660-161aa742ca0c)
I can change to the previous week, no problem
![image](https://github.com/user-attachments/assets/2821a6a8-4ca2-4bcc-8474-348fa92a16dd)
Note the cpu load on the right, the spike occurs when I change the week, but its okay, because the calculation is finished after some time.
Now if I change to the week before that the CPU load does not decrease
![image](https://github.com/user-attachments/assets/0c4e8602-8cfd-47b2-b5be-e94c356cf851)
At some time a timeout message is displayed and a warning in the logs
![image](https://github.com/user-attachments/assets/aa4e65f1-f1f7-47fe-b6f9-9c3cea6f39af)
But even though the request is supposed to time out, the CPU usage stays at 100%
![image](https://github.com/user-attachments/assets/f0c2b1b0-1162-4c13-9d0b-718ddd442c80)
Pressing Ctrl C does not do anything
![image](https://github.com/user-attachments/assets/00d52779-6203-4b57-a19b-bf620b6f8ae7)
But sending SIGTERM works
![image](https://github.com/user-attachments/assets/f9480175-8456-41fb-91e9-28bf2ef511ec)
![image](https://github.com/user-attachments/assets/bdbcc726-bcb3-4f57-b569-f9f3486994db)

## Expected behavior

Just seeing the stats of that week
## Documentation

Logs:
[aw-log-bug.log](https://github.com/user-attachments/files/18328030/aw-log-bug.log)

## Additional context

Maybe related to #239

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.