jazzband / Watson

:watch: A wonderful CLI to track your time!
http://tailordev.github.io/Watson/
MIT License
2.46k stars 240 forks source link

aggregate hangs when --to given #478

Closed TLINDEN closed 2 years ago

TLINDEN commented 2 years ago

If I want to see an aggregate of the whole month, I'd enter: watson aggregate -f 2022-07-01 -t 2202-07-31

(or since today is only the 11th: -t 2202-07-11)

But whatever I give to --to leads watson to hang infinitely. It works without --to however:

% watson aggregate --from 2022-07-01   
Fri 01 July 2022 - 00s

Sat 02 July 2022 - 00s

Sun 03 July 2022 - 00s

Mon 04 July 2022 - 00s

Tue 05 July 2022 - 4h 14m 49s
  100568           cloudnative - 4h 14m 49s

Wed 06 July 2022 - 7h 42m 59s
  100568           cloudnative - 7h 14m 52s

  pause - 28m 07s

Thu 07 July 2022 - 3h 07m 34s
  100568           cloudnative - 3h 07m 34s

Fri 08 July 2022 - 5h 46m 08s
  100568           cloudnative - 5h 46m 08s

Sat 09 July 2022 - 00s

Sun 10 July 2022 - 00s

Mon 11 July 2022 - 5h 53m 41s
  100568           cloudnative - 5h 53m 41s

This is the strace output when it hangs, hang stats at the mmap() calls:

[..]
openat(AT_FDCWD, "/home/scip/.config/watson/config", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0600, st_size=45, ...}, AT_EMPTY_PATH) = 0
ioctl(3, TCGETS, 0x7ffce17e58a0)        = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR)                   = 0
ioctl(3, TCGETS, 0x7ffce17e5700)        = -1 ENOTTY (Inappropriate ioctl for device)
read(3, "[options]\npager = false\nstop_on_"..., 8192) = 45
read(3, "", 8192)                       = 0
close(3)                                = 0
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd32e348000
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd32e308000
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd32e2c8000
brk(0x1279000)                          = 0x1279000
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd32e288000
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd32e248000
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd32e208000
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd32e1c8000
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd32e188000
mmap(NULL, 262144, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd32e148000
^C--- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
strace: Process 89948 detached

Env:

Python 3.9.5
Watson 1.8.0
ericguirbal commented 2 years ago

Replace watson aggregate -f 2022-07-01 -t 2202-07-31 with watson aggregate -f 2022-07-01 -t 2022-07-31.

TLINDEN commented 2 years ago

LOL, ok that 'fixes' it :)

However, a error message like this would help a lot: "flux compensator unavailable, please use a date from the past!"

And it should not hang forever in such a case.

best regards, and thanks a lot for this tool!

jmaupetit commented 2 years ago

That's an odd edge-case! Thanks for having it reported :pray: