Page 1 of 2

Double Noticed

Posted: 7. Nov 2011, 05:03
by ghostdawg
When I came home this evening, I saw two package update notification icons in the bottom tray. After running the update and upgrade, it was only upgrading Firefox to version 8.0. I'm running Xfce4 with Salix 13.37.

I just thought I would mention this, as it seems odd to have two notification icons showing.

Thnx.

Re: Double Noticed

Posted: 7. Nov 2011, 15:56
by gapan
This has come up before. But it is very hard to reproduce, I haven't been able to do so, yet. If we can't see what's wrong, it can't be fixed. If you find a way to faithfully reproduce it, please post a follow up and we'll see what we can do.

Re: Double Noticed

Posted: 7. Nov 2011, 23:16
by ghostdawg
Thanks for the reply. I'll try to see what I can find. What is the name of the notification program that runs when updates are ready?

Thnx.

Re: Double Noticed

Posted: 7. Nov 2011, 23:21
by gapan
salix-update-notifier

Re: Double Noticed

Posted: 8. Nov 2011, 20:21
by ghostdawg
Here is image of the double notification icons. Just to show how it looks.

Image

Thnx.

Re: Double Noticed

Posted: 9. Nov 2011, 20:48
by Shador
I was able to reproduce this problem (xfce livecd rc and openbox beta). Boot your computer and log in. Now check for running salix-update-notifier processes. There should be exactly one. Now log out and log in again (I only tried with the same user). Now checking there are two instances.
So apparently salix-update-notifier doesn't quit properly with the session.

Re: Double Noticed

Posted: 11. Nov 2011, 23:07
by ghostdawg
Shador, you are correct, there are two instances of salix-update-notifier listed. Also I found there are two instances of gdm-binary listed. I'm not sure if it is related or not, but thought I bring it up.

Good catch on that double notifier.

Thnx.

Re: Double Noticed

Posted: 16. Nov 2011, 20:31
by Shador
Wrapping the salix-update-notifier code with this, should kill previous instances of the same user:

Code: Select all

#!/bin/bash

# the per-user lockfile
LOCK="$HOME/.salix-update-notifier.lock"

(

if ! flock -n 200; then
	# kill the other one (childs too just to be sure)
	OPID=`cat "$LOCK"`
	if [ -n "$OPID" ]; then
		CPIDS=$(pgrep -P $OPID)
		kill -TERM $OPID $CPIDS >/dev/null 2>&1
		(sleep 30; kill -KILL $OPID $CPIDS ) >/dev/null 2>&1 &
	fi
	# now free the lockfile and reopen it
	rm -f "$LOCK" >/dev/null 2>&1
	exec 200>"$LOCK"
	if ! flock -w 60 200; then
		# this shouldn't usually happen
		echo "Couldn't acquire lock on: '$LOCK'"
		exit 1
	fi
fi
# ready to go so store our pid
echo $$ >"$LOCK"

# now start working
while true; do
	echo "still there"
	sleep 10s
done

) 200>>"$LOCK"
This is not optimal because when logging of the salix-update-notifier instance continues running (possibly for ever?). But at least it ensures, we don't get two instances for the same user.

Re: Double Noticed

Posted: 17. Nov 2011, 21:07
by ghostdawg
Well, up to this point, I haven't seen another two instances of the update notifier showing. I did have one a couple of days ago. So I'll keep an eye out and see if it happens again.

Thnx.

Re: Double Noticed

Posted: 17. Nov 2011, 21:22
by Shador
Yes, but that's just because it's quite unlikely. How often do you logout and relogin without rebooting? How often do you get updates? Low * low probability = very low probability.