tmux
tmux copied to clipboard
Bug: Enabling Weather plugin causes my MBP fans to increase globle warming
Describe the bug
Hi Devs - When using the weather plugin the fans on my '19 MBP (using Catalina/zsh/oh-my-zsh) spin up and don't stop until I shut down tmux. A couple of things seem to have helped.
Setting the refresh to something more that 5 seems to help:
set -g @dracula-refresh-rate 30
It looks like this statement in sleep_weather.sh produces an error because grep doesn't find anything. I can see that extra processes aren't getting killed:
[ -f $LOCKFILE ] && ps -p "$(cat $LOCKFILE)" -o cmd= | grep -F " ${BASH_SOURCE[0]}" && kill "$(cat $LOCKFILE)"
Removing the leading space in " ${BASH_SOURCE[0]}"
seems to produce the desired result on my system.
To Reproduce
Starting tmux with Dracula enable and using the weather/location plugin.
Expected behavior
I run tmux and my machine is quiet as a mouse.
System
- OS: 19 MBP (using Catalina/zsh/oh-my-zsh)
- Tmux Version: tmux 3.1c
I'll need to test this, but it makes sense. Feel free to send in a PR.
@devnolly I couldn't replicate this on my system but you are probably right. Could you please share the output of ps -p "$(cat /tmp/.dracula-tmux-weather.lock)" -o cmd=
on your system (in bash)? I'm curious if the output differs between OS's or ps versions. ps from procps-ng 3.3.17 on mine shows: bash /home/user/.tmux/plugins/tmux/scripts/sleep_weather.sh true true
Thanks
@devnolly I couldn't replicate this on my system but you are probably right. Could you please share the output of
ps -p "$(cat /tmp/.dracula-tmux-weather.lock)" -o cmd=
on your system (in bash)? I'm curious if the output differs between OS's or ps versions. ps from procps-ng 3.3.17 on mine shows:bash /home/user/.tmux/plugins/tmux/scripts/sleep_weather.sh true true
Thanks
I get the same output actually.
Thanks for taking a look. Here's the output.
` bash-3.2$ ps -p "$(cat /tmp/.dracula-tmux-weather.lock)" -o cmd= ps: cmd: keyword not found ps: no valid keywords; valid keywords: %cpu %mem acflag acflg args blocked caught comm command cpu cputime etime f flags gid group ignored inblk inblock jobc ktrace ktracep lim login logname lstart majflt minflt msgrcv msgsnd ni nice nivcsw nsignals nsigs nswap nvcsw nwchan oublk oublock p_ru paddr pagein pcpu pending pgid pid pmem ppid pri pstime putime re rgid rgroup rss ruid ruser sess sig sigmask sl start stat state stime svgid svuid tdev time tpgid tsess tsiz tt tty ucomm uid upr user usrpri utime vsize vsz wchan wq wqb wql wqr xstat
bash-3.2$ ps -p "$(cat /tmp/.dracula-tmux-weather.lock)" PID TTY TIME CMD 36697 ?? 0:00.35 bash /Users/ENoll5/.tmux/plugins/tmux/scripts/sleep_weather.sh true true bash-3.2$ `
Not sure if this helps.
` ➜ scripts (master) ✗ cat lock.sh #!/usr/bin/env bash LOCKFILE=/tmp/.dracula-tmux-weather.lock
echo "With leading space" printf "[ -f $LOCKFILE ] && ps -p "$(cat $LOCKFILE)" -o cmd= | grep -F " ${BASH_SOURCE[0]}" && kill "$(cat $LOCKFILE)"" echo echo "Without leading space" printf "[ -f $LOCKFILE ] && ps -p "$(cat $LOCKFILE)" -o cmd= | grep -F "${BASH_SOURCE[0]}" && kill "$(cat $LOCKFILE)"" ➜ scripts (master) ✗ ./lock.sh With leading space [ -f /tmp/.dracula-tmux-weather.lock ] && ps -p 36697 -o cmd= | grep -F Without leading space [ -f /tmp/.dracula-tmux-weather.lock ] && ps -p 36697 -o cmd= | grep -F ./lock.sh && kill 36697%
`
So is there potentially a problem on MacOS? Because of the way MacOS ps works? That's what I'm assuming.
It looks like ps on OSX doesn't support the "cmd" keyword. It's an alias for "args", so we should probably just use that. Could you please see if this works for your sleep_weather.sh?
[ -f $LOCKFILE ] && ps -p "$(cat $LOCKFILE)" -o args= | grep -F " ${BASH_SOURCE[0]}" && kill "$(cat $LOCKFILE)"
This worked on my machine with macOS Monterrey 12.5.1:
[ -f $LOCKFILE ] && ps -p "$(< $LOCKFILE)" -o args= | grep -F " ${BASH_SOURCE[0]}" && kill "$(< $LOCKFILE)"
Hello, I dont have the same exact issue, but I saw on my Linux laptop that the weather
one had also my fans going crazy. I found out that it was linked to the rev
command, and some sleep maybe.
I dont have that issue on my OSX work laptop though.