Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Enabling Weather plugin causes my MBP fans to increase globle warming #94

Open
devnolly opened this issue Mar 9, 2021 · 10 comments
Labels
bug Something isn't working

Comments

@devnolly
Copy link

devnolly commented Mar 9, 2021

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
@devnolly devnolly added the bug Something isn't working label Mar 9, 2021
@ethancedwards8
Copy link
Member

I'll need to test this, but it makes sense. Feel free to send in a PR.

@xunoaib
Copy link
Contributor

xunoaib commented Mar 16, 2021

@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

@ethancedwards8
Copy link
Member

@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.

@devnolly
Copy link
Author

devnolly commented Mar 19, 2021

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$
`

@devnolly
Copy link
Author

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%

`

@ethancedwards8
Copy link
Member

So is there potentially a problem on MacOS? Because of the way MacOS ps works? That's what I'm assuming.

@xunoaib
Copy link
Contributor

xunoaib commented Mar 19, 2021

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)"

@tmigone
Copy link
Contributor

tmigone commented Aug 26, 2022

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)"

@es-tii
Copy link

es-tii commented Aug 14, 2023

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.

@alaamroue
Copy link
Contributor

#313 should probably resolve this. I had the same issue with rev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

6 participants