matryer / xbar

Put the output from any script or program into your macOS Menu Bar (the BitBar reboot)
https://xbarapp.com
MIT License
17.5k stars 642 forks source link

Duplicated menu items #21

Closed alesf closed 8 years ago

alesf commented 8 years ago

MBP, El Capitan, v. 1.3.1

When I wake computer from sleep multiple instances are shown in menubar.

screen shot 2015-12-27 at 10 13 21
johngibb commented 8 years ago

Same here:

screen shot 2016-01-05 at 9 51 55 am
matryer commented 8 years ago

What version are you running?

On 5 Jan 2016, at 14:53, John Gibb notifications@github.com wrote:

Same here:

https://cloud.githubusercontent.com/assets/619602/12118000/1e99fc00-b392-11e5-890e-ea9e5faa2a69.png — Reply to this email directly or view it on GitHub https://github.com/matryer/bitbar/issues/21#issuecomment-169021901.

steigr commented 8 years ago

+1

johngibb commented 8 years ago

v1.3.1 @matryer

matryer commented 8 years ago

Do you have Xcode? Could you run the master code to test this? I think it was fixed after 1.3.1...

On 5 Jan 2016, at 14:59, John Gibb notifications@github.com wrote:

v1.3.1 @matryer https://github.com/matryer — Reply to this email directly or view it on GitHub https://github.com/matryer/bitbar/issues/21#issuecomment-169025223.

alesf commented 8 years ago

I wanted to test it with master but there are some problems with LaunchAtLoginController as you mentioned here https://github.com/matryer/bitbar/issues/27.

The problem is also non-consistent. Sometimes it duplicates, sometimes it doesn't.

johngibb commented 8 years ago

I just built master, and slept then awoke, and didn't see any duplication. As alesf said though, it didn't seem to happen every time—I'll keep you posted if I see it again.

matryer commented 8 years ago

I think it's fixed in the latest - I plan to release v1.4 this weekend.

johngibb commented 8 years ago

Happened again with master, don't think it's fixed:

screen shot 2016-01-06 at 10 01 38 am

matryer commented 8 years ago

What version is that?

On 6 Jan 2016, at 15:02, John Gibb notifications@github.com wrote:

Happened again with master, don't think it's fixed:

https://cloud.githubusercontent.com/assets/619602/12145507/928ae582-b45c-11e5-9687-323e6a2c8475.png — Reply to this email directly or view it on GitHub https://github.com/matryer/bitbar/issues/21#issuecomment-169346332.

johngibb commented 8 years ago

Sorry, meant to paste in the SHA

6dbeb0b636901f737dc94cab88e346b6a8ddaf99

matryer commented 8 years ago

Can you please provide the steps to reproduce this?

matryer commented 8 years ago

Is it many BitBar instances running? Or is it one instance with many plugins?

What does Activity Monitor show when you search for BitBar?

johngibb commented 8 years ago

I don't have any reason to believe that there would have been multiple instances running, all I did was hit run from xcode yesterday afternoon. I slept the computer and awoke it a few times, and it was fine. Then, after the computer had slept overnight, when I awoke it this morning I saw what's in the above screenshot.

I unfortunately have already killed and restarted it, so I can't tell you what activity monitor says; if it happens again, I'll capture that information for you.

matryer commented 8 years ago

Thanks - I am wondering if it’s an Xcode thing or if running the app directly also does it.

Perhaps you can try with the latest release candidate?

On 6 Jan 2016, at 15:17, John Gibb notifications@github.com wrote:

I don't have any reason to believe that there would have been multiple instances running, all I did was hit run from xcode yesterday afternoon. I slept the computer and awoke it a few times, and it was fine. Then, after the computer had slept overnight, when I awoke it this morning I saw what's in the above screenshot.

I unfortunately have already killed and restarted it, so I can't tell you what activity monitor says; if it happens again, I'll capture that information for you.

— Reply to this email directly or view it on GitHub https://github.com/matryer/bitbar/issues/21#issuecomment-169352198.

johngibb commented 8 years ago

Sure, I'll give that a shot. FWIW it originally happened when I used the 1.3 release that was available when the hacker news post went up, so it's happened when I wasn't running via xcode as well. I only used xcode to try a more recent version than what was available as an official release.

matryer commented 8 years ago

It’s possible 1.3 is still on your system somewhere… you can see the version number if you look in the “Preferences” menu for each item. Perhaps you have different versions running?

On 6 Jan 2016, at 15:29, John Gibb notifications@github.com wrote:

Sure, I'll give that a shot. FWIW it originally happened when I used the 1.3 release that was available when the hacker news post went up, so it's happened when I wasn't running via xcode as well. I only used xcode to try a more recent version than what was available as an official release.

— Reply to this email directly or view it on GitHub https://github.com/matryer/bitbar/issues/21#issuecomment-169357900.

johngibb commented 8 years ago

I was sure to kill 1.3 before running via xcode, so don't think that's it. but I've killed them all and started 1.4beta already so I can't provide evidence :)

Only one running now:

$ ps aux | grep -i bitbar
johngibb         19101   0.0  0.0  2434836    764 s000  S+   10:34AM   0:00.00 grep -i bitbar
johngibb         18964   0.0  0.1  2549904  19224   ??  S    10:30AM   0:00.84 /Applications/BitBar.app/Contents/MacOS/BitBar -psn_0_4940982

$ cat /Applications/BitBar.app/Contents/Info.plist | grep -A1 CFBundleShortVersionString
<key>CFBundleShortVersionString</key>
<string>1.4beta</string>

if it happens again, I'll provide the same output, let me know if there's anything else you want me to capture as well.

matryer commented 8 years ago

That’s a great start - thanks for helping

On 6 Jan 2016, at 15:37, John Gibb notifications@github.com wrote:

I was sure to kill 1.3 before running via xcode, so don't think that's it. but I've killed them all and started 1.4beta already so I can't provide evidence :)

Only one running now:

$ ps aux | grep -i bitbar johngibb 19101 0.0 0.0 2434836 764 s000 S+ 10:34AM 0:00.00 grep -i bitbar johngibb 18964 0.0 0.1 2549904 19224 ?? S 10:30AM 0:00.84 /Applications/BitBar.app/Contents/MacOS/BitBar -psn_0_4940982

$ cat /Applications/BitBar.app/Contents/Info.plist | grep -A1 CFBundleShortVersionString

CFBundleShortVersionString 1.4beta

if it happens again, I'll provide the same output, let me know if there's anything else you want me to capture as well.

— Reply to this email directly or view it on GitHub https://github.com/matryer/bitbar/issues/21#issuecomment-169361238.

alesf commented 8 years ago

Same on version 1.3.1. Only one instance running with duplicates in menubar.

$ ps ax | grep BitBar 39151 ?? S 16:13.70 /Applications/BitBar.app/Contents/MacOS/BitBar 55384 s001 S+ 0:00.00 grep BitBar

johngibb commented 8 years ago

Happened again, 1.4beta and only one instance:

screen shot 2016-01-06 at 9 14 52 pm
$ ps aux | grep -i bitbar
johngibb         18964   0.1  0.4  2719668  60176   ??  S    10:30AM   2:52.87 /Applications/BitBar.app/Contents/MacOS/BitBar -psn_0_4940982
johngibb         97975   0.0  0.0  2444052    780 s000  S+    9:15PM   0:00.00 grep -i bitbar

$ cat /Applications/BitBar.app/Contents/Info.plist | grep -A1 CFBundleShortVersionString
<key>CFBundleShortVersionString</key>
<string>1.4beta</string>
alesf commented 8 years ago

I'm now also on 1.4beta with only one instance running directly from XCode with some additional weirdness.

When I closed the lid yesterday there was only one instance. Upon waking from sleep in the morning I saw this.

screen shot 2016-01-07 at 07 58 30

Then after a minute or so it changed to this.

screen shot 2016-01-07 at 08 00 32

And also a minute or so later to this.

screen shot 2016-01-07 at 08 01 53

There was additional BitBar menu item at first that said no plugins are installed and one menu item with a different value (-5°C). All items were marked as "Updated just now". Later on BitBar menu item disappeared and menu item with different value got updated.

Also, when I refresh any item from its dropdown menu only leftmost item shows three dots indicating refreshing and only that item has correct last update time. All other items are showing "Updated just now".

matryer commented 8 years ago

I wonder whether this is an Xcode oddity - or a bug in the app.

On 7 Jan 2016, at 07:08, Aleš Farčnik notifications@github.com wrote:

I'm now also on 1.4beta with only one instance running directly from XCode with some additional weirdness.

When I closed the lid yesterday there was only one instance. Upon waking from sleep in the morning I saw this.

https://cloud.githubusercontent.com/assets/1148574/12164344/1b356b92-b515-11e5-9abc-1186b6e4fe4b.png Then after a minute or so it changed to this.

https://cloud.githubusercontent.com/assets/1148574/12164349/27c071b8-b515-11e5-9a3e-dea521af3cf4.png And also a minute or so later to this.

https://cloud.githubusercontent.com/assets/1148574/12164357/360d2536-b515-11e5-9c8e-e953b66d5437.png There was additional BitBar menu item at first that said no plugins are installed and one menu item with a different value (-5°C). All items were marked as "Updated just now". Later on BitBar menu item disappeared and menu item with different value got updated.

Also, when I refresh any item from its dropdown menu only leftmost item shows three dots indicating refreshing.

— Reply to this email directly or view it on GitHub https://github.com/matryer/bitbar/issues/21#issuecomment-169577490.

LeoBreebaart commented 8 years ago

I am not sure if sleeping/waking is the sole trigger for this bug. I have written my first plugin (in Python) today, and I have had it happen multiple times (but without being able to reproduce it reliably) that, during editing and testing, an execution path containing a static print statement like print("BOO!"); sys.exit() will cause BOO! BOO! BOO! to appear in the menu bar. Using the BitBar reset option doesn't help, but quitting and restarting BitBar always does. I do have XCode on my system, but am simply running v1.3.1 as app installed with brew.

matryer commented 8 years ago

I have a theory that new builds of BitBar automatically set the “Open at login” feature. And they’re all hanging around in Derived Data somewhere. What’s in Preferences > Users & Groups > Login Items for you?

On 8 Jan 2016, at 21:07, Leo Breebaart notifications@github.com wrote:

I am not sure if sleeping/waking is the sole trigger for this bug. I have written my first plugin (in Python) today, and I have had it happen multiple times (but without being able to reproduce it reliably) that, during editing and testing, an execution path containing a static print statement like print("BOO!"); sys.exit() will cause BOO! BOO! BOO! to appear in the menu bar. Using the BitBar reset option doesn't help, but quitting and restarting BitBar always does. I do have XCode on my system, but am simply running v1.3.1 as app installed with brew.

— Reply to this email directly or view it on GitHub https://github.com/matryer/bitbar/issues/21#issuecomment-170123808.

matryer commented 8 years ago
screen shot 2016-01-08 at 21 09 49
LeoBreebaart commented 8 years ago

Mine shows just a single BitBar at the moment, but I will keep an eye out and check what it looks like if the multiplication happens again.

matthewrobertbell commented 8 years ago

This happens for me as well after sleeping, single bash script containing "curl -s someurl"

alesf commented 8 years ago

It could be that it has nothing to do with sleep. I have two plugins. One bash plugin that calls curl function, the other simple python script for fuzzy clock. The python fuzzy clock never duplicates, the bash plugin was fine for some time, but is now showing two instances. And the computer has been put to sleep many times.

I'm on 1.4 beta2.

hmottestad commented 8 years ago

I have the newest v1.5 beta, and I'm seeing this too. I've had "Open at login" enabled, but I've disabled it now to see if it helps.

alesf commented 8 years ago

I've been using 1.4-beta.2 a while now and for most of the time the problem seems to be gone. It sometimes still duplicates one plugin, but it resolves by itself (before I had to relaunch BitBar for it to work).

hmottestad commented 8 years ago

My 1.5 beta is still producing duplicate items in the toolbar. Now it's got 4 items. "Open at login" has been disabled.

v1.5 beta 1

matryer commented 8 years ago

Can you look in Activity Monitor to see how many instances of BitBar are running?

hmottestad commented 8 years ago

It's just 1 process. Currently I have 4 duplicates in totalt in my toolbar.

Here is a screenshot with stats. The thread count varies from 6 to 11.

screen shot 2016-01-25 at 09 49 32

I quit bitbar. To see if the threads would change. It's now running with 5-11 threads.

hmottestad commented 8 years ago

@alesf @mattseh I also use curl in my script. Maybe curl it giving some funky output every once in a while, eg if there isn't any network, and this cause Bitbar to show multiple items in the menu bar. I use curl with grep and awk, so it's fairly unlikely. But it might spit out something on stderr.

alesf commented 8 years ago

This could be the case. I now have all local scripts and come to think of it the problem hasn’t occurred since.

krzysztofjablonski commented 8 years ago

I had the same issue and I also use curl. The issue is when you wake up your computer there is no internet connection yet so curl is retuning empty response. Somehow when script returns no output BitBar start multiple instances of the script. I fixed it with curl http://example.com || echo "..."

matryer commented 8 years ago

I think no response from a script should cause the menu item to be hidden, not duplicate them. Right?

On 9 Feb 2016, at 13:23, Krzysztof Jablonski notifications@github.com wrote:

I had the same issue and I also use curl. The issue is when you wake up your computer there is no internet connection yet so curl is retuning empty response. Somehow when script returns no output BitBar start multiple instances of the script. I fixed it with curl http://example.com || echo "..."

— Reply to this email directly or view it on GitHub https://github.com/matryer/bitbar/issues/21#issuecomment-181862302.

hmottestad commented 8 years ago

What about the timeout. I set my script to run every 10 seconds, what if curl takes more than 10 seconds to timeout, then you might get multiple replies when curl times out.

hmottestad commented 8 years ago

I'm currently trying: curl -s -m 10 http://.... 2>/dev/null

In a script that runs every 20 seconds. This should make curl timeout before the script is rerun, and any messages on stderr will go to /dev/null

hmottestad commented 8 years ago

Nope. Doesn't help. I still got two bitbars in my menu bar.

squfrans commented 8 years ago

i am seeing this also with latest beta, only 2 local scripts: memory meter and cpu meter (both using spark). the number of cpu meters slowly increases during the day.

edit: definitely reproducible for me every time after sleep/wakeup.

chinchang commented 8 years ago

+1

vijayrawatsan commented 8 years ago

+1 still happening for me 1.5.2 beta 2

matryer commented 8 years ago

Sorry about this one, it's a tough one to reproduce. Will give it some attention this week.

mm2270 commented 8 years ago

Hi. I just updated to the newly released 1.5 version (non beta) and I'm now seeing this exact issue, which I'm 100% certain wasn't happening before on 1.5 Beta 2. If I choose "Refresh" from the Preferences submenu, my installed plug-ins duplicate in the menubar. It seems related to this discussion.

This only happens on a manual refresh as far as I can tell, not when the plug-ins refresh on their defined cycle. Here's a screenshot showing only one instance of BitBar running as per Activity Monitor, but multiple menu items showing in the menubar after choosing Refresh.

What's unclear to me is why I would be seeing this now under 1.5 and not with the previous 1.5 beta 2 version. I know others were seeing this under the Beta 2 version, but I never did. Very strange. What could have changed between the versions that would cause this now?

matryer commented 8 years ago

We're trying a few things and it's somewhat tricky. We'll figure it out. Thanks for your patience while we address this.

On 16 Feb 2016, at 19:28, Mike M notifications@github.com wrote:

Hi. I just updated to the newly released 1.5 version (non beta) and I'm now seeing this exact issue, which I'm 100% certain wasn't happening before on 1.5 Beta 2. If I choose "Refresh" from the Preferences submenu, my installed plug-ins duplicate in the menubar. It seems related to this discussion.

This only happens on a manual refresh as far as I can tell, not when the plug-ins refresh on their defined cycle. Here's a screenshot showing only one instance of BitBar running as per Activity Monitor, but multiple menu items showing in the menubar after choosing Refresh.

What's unclear to me is why I would be seeing this now under 1.5 and not with the previous 1.5 beta 2 version. I know others were seeing this under the Beta 2 version, but I never did. Very strange. What could have changed between the versions that would cause this now?

— Reply to this email directly or view it on GitHub.

mm2270 commented 8 years ago

Thanks @matryer. I know you guys are working on it. Just wanted to comment on it since it was new for me. Other than that issue, the 1.5 release looks good to me. I especially like the fix for #219 since that one was bugging me from a UI standpoint.

Also, I confirmed that reverting to 1.5 Beta 2 I'm not seeing the duplicated menubar items, so for me at least, I'm only seeing it show up in the final 1.5 release, for whatever that's worth.

mm2270 commented 8 years ago

Happy to say that the just released 1.5.1 seems to fix the issue for me. No more dupes! At least not when manually refreshing. I'll do some testing with sleep/wake later to confirm.

But I'm only one person. Will be interesting to see if it addresses it for others. Here's hoping!

Thanks for continuing to make improvements and fixes to BitBar! 👍

matryer commented 8 years ago

Thanks for your patience and support. Also, check out the new Add to BitBar button on getbitbar.com and the new Option Key feature :)

On 16 Feb 2016, at 22:22, Mike M notifications@github.com wrote:

Happy to say that the just released 1.5.1 seems to fix the issue for me. No more dupes! At least not when manually refreshing. I'll do some testing with sleep/wake later to confirm.

But I'm only one person. Will be interesting to see if it addresses it for others. Here's hoping!

Thanks for continuing to make improvements and fixes to BitBar! 👍

— Reply to this email directly or view it on GitHub.