pspy
pspy copied to clipboard
Strange behaviour on Centos 7 based system when monitoring dirs
_# ./pspy64 -p=false -f pspy - version: v1.2.0 - Commit SHA: 9c63e5d6c58f7bcdc235db663f5e3fe1c33b8855
Config: Printing events (colored=true): processes=false | file-system-events=true ||| Scannning for processes every 100ms and on inotify events ||| Watching directories: [/usr /tmp /etc /home /var /opt] (recursive) | [] (non-recursive) Draining file system events due to startup..._
Running the above just hangs. Assuming because Draining file system events due to startup never goes to 'done'. The only way i can recover from that point is with CTRL-Z to background the process and then kill it. If i change the directory manually to only /home or /opt or other systems dirs it works fine. Seems like only a problem with /usr /tmp /etc & /var. Tried these dirs with non-recursive mode and had the same problem.
Any ideas ?
hmmm so this is really surprising. since it prints the message about draining events, we for sure got here during startup, and since "done" is not printed, we get stuck somewhere within drainEventsFor (code).
Other than allowing you to CTRL-z out of the program, it just waits for a fixed duration (1 sec, hardcoded), returns after that, and ignores all other events meanwhile.
Golang's time.After(1 * time.Second) is basically a nice way of writing NewTimer(1 * time.Second).C and the docs about this timer say that it "will send the current time on its channel after at least duration" 1 second. There is no guarantee for good accuracy and for sure things like CPU load may cause additional delay. Still, a delay so long that it's annoying for humans sounds pretty extreme to me.
Since pspy will walk the file system and place watchers everywhere, its conceivable that the system might be under stress. Maybe that's causing the problem. Wild theory, I know...
Do you still have access to the box? Can you run htop or something similar and check what the load is during startup?
Was able to reproduce this problem on one of my systems and changed the draining logic a bit to make it go away. If you build from master it should be better now.
Any chance you might be inclined to publish a new release with this fix? Master build solved this issue for me as well.
I will, I will :)
and there it is: https://github.com/DominicBreuker/pspy/releases/tag/v1.2.1
I assume it is gone. Please open new issues if not