Double Noticed

Other talk about Salix
User avatar
laprjns
Salix Warrior
Posts: 1113
Joined: 28. Aug 2009, 01:30
Location: Connecticut USA

Re: Double Noticed

Post by laprjns »

Shador wrote:I was able to reproduce this problem (xfce livecd rc and openbox beta). Boot your computer and log in.
I can reproduce this also by logging out then in again. In fact I've seen three update icons at one time.
Shador wrote: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.
Yup, seen this too.
Shador wrote:So apparently salix-update-notifier doesn't quit properly with the session.
It doesn't shut down at all. After logging out, fire up a console session log in as root and run htop. You'll see that the salix-update-notifier is running under the user that you just logged out as. If fact if I recall there were some other processes that were still running under the user that had just logged out. Shouldn't they all be closed down on log out??
“The past was erased, the erasure was forgotten, the lie became the truth.”
― George Orwell, 1984
User avatar
JRD
Salix Warrior
Posts: 950
Joined: 7. Jun 2009, 22:52
Location: Lyon, France

Re: Double Noticed

Post by JRD »

Code: Select all

LOCK="$HOME/.salix-update-notifier.lock"
That is the wrong way to do.
It should be :

Code: Select all

LOCK=$([ -n "$XDG_CACHE_HOME" ] && echo "$XDG_CACHE_HOME" || echo "$HOME/.cache")/.salix-update-notifier.lock
I looked in the source code of salix-update-notifier. I think the problem is on that line :

Code: Select all

sleep $INTERVAL || sleep $DEFAULT_INTERVAL
Well, form what I saw, in normal ways, INTERVAL is not null, so the first sleep should always work...so the "||" is never run.
But, when logout, a signal is received and the first sleep fail, so the second is run...so the process remains there for about 2 hours.
I think this code is safer :

Code: Select all

[ -n "$INTERVAL"] || INTERVAL=$DEFAULT_INTERVAL
sleep $INTERVAL
Another idea is using "trap" in the script to do some actions when receiving the signal at end of session.
Image
Shador
Posts: 1295
Joined: 11. Jun 2009, 14:04
Location: Bavaria

Re: Double Noticed

Post by Shador »

JRD wrote:

Code: Select all

LOCK="$HOME/.salix-update-notifier.lock"
That is the wrong way to do.
It should be :

Code: Select all

LOCK=$([ -n "$XDG_CACHE_HOME" ] && echo "$XDG_CACHE_HOME" || echo "$HOME/.cache")/.salix-update-notifier.lock
Why? There's absolutely no relation between cache data and lockfiles/pid files. Do you see a single lockfile in $HOME/.cache (or whatever XDG_CACHE_HOME is set to in your case)? Do you see a single one in /var/cache. The only lockfile/pidfile I can see here is in $HOME is .openshot/pid.lock and there's no equivalent to /var/run.
You could of course argue putting it into a subfolder like $XDG_CONFIG_HOME/salix-update-notifier or $HOME/.salix-update-notifier. But that makes the path I chose not at all wrong and it was just a suggestion anyway.
JRD wrote: I looked in the source code of salix-update-notifier. I think the problem is on that line :

Code: Select all

sleep $INTERVAL || sleep $DEFAULT_INTERVAL
Well, form what I saw, in normal ways, INTERVAL is not null, so the first sleep should always work...so the "||" is never run.
But, when logout, a signal is received and the first sleep fail, so the second is run...so the process remains there for about 2 hours.
I think this code is safer :

Code: Select all

[ -n "$INTERVAL"] || INTERVAL=$DEFAULT_INTERVAL
sleep $INTERVAL
Another idea is using "trap" in the script to do some actions when receiving the signal at end of session.
Apparently no signal (no SIGTERM at least) gets sent to salix-update-notifier. Because I'm having no problems here terminating the process by the sigterm signal. Also a loop like this can be killed without problems by SIGTERM too:

Code: Select all

( sleep 2h || sleep 2h ) &
This is not too surprising to me as it's listed as a child of init.
laprjns wrote: If fact if I recall there were some other processes that were still running under the user that had just logged out. Shouldn't they all be closed down on log out??
What processes? Which edition?
Image
User avatar
gapan
Salix Wizard
Posts: 6354
Joined: 6. Jun 2009, 17:40

Re: Double Noticed

Post by gapan »

This is not that easy to fix. It has nothing to do with the sleep command. Shador's idea with flock seems the best so far, but as Shador noted, it has its drawbacks. The problem is that any application that is not actively using X, will not shut down when a user logs out. And it doesn't have to do with logging out, even if it is an app that is actively using X. It's just that since X is being shut down, all apps that are using X are stopped too. Anything that is running in the background, will continue to run after the user has logged out, until it finishes, or someone kills it. For example, that's how GNU screen is able to keep running even after the user has logged out and he can pick it up again where he left it when he logs back in.

The only way that I can think of, in order to not have any remaining processes at all in any case, is to rewrite the notifier from scratch, have it display an icon in the tray at all times, so that when X shuts down, it takes the notifier with it. The notifier could be animating/changing colour when there are any updates and we could also have the permanent icon show up a right click menu with options like "Check for updates now" or "Launch Gslapt". That's only just an idea though, I'm not sure I want a package manager icon showing up at all times in my tray.

Given that this is occurring very rarely, and even then it's not critical, only just cosmetic, I'm not in much of a hurry to find a fix.
Image
Image
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: Double Noticed

Post by mimosa »

I'm not sure if the two problems are related - I suppose not - but today I got that thing where the notifier appears but there's nothing to update, using Salix Live RC1 (or maybe it was in the Salix 13.37 I installed with it). That's actually more annoying than the double notifier, though I suppose even that's disconcerting if you don't know it doesn't really matter.
User avatar
gapan
Salix Wizard
Posts: 6354
Joined: 6. Jun 2009, 17:40

Re: Double Noticed

Post by gapan »

No, that shouldn't be the same. Maybe you have updated or have removed the package that was to be updated manually in the meantime.
Image
Image
User avatar
JRD
Salix Warrior
Posts: 950
Joined: 7. Jun 2009, 22:52
Location: Lyon, France

Re: Double Noticed

Post by JRD »

It's not related but it happens to me too when I have blacklist some software from updates. The update check does not take into account the blacklisted software.
That is one of the reason I don't use salix-update-notifier on my machine. I, instead, wrote a script for xfce-genmon plugin. Of course it works only in Xfce but that's ok for me.
Image
Shador
Posts: 1295
Joined: 11. Jun 2009, 14:04
Location: Bavaria

Re: Double Noticed

Post by Shador »

Hmm, seems to work fine here:

Code: Select all

$ LANG=C /usr/sbin/slapt-get -s --upgrade # blacklisted
Reading Package Lists...Done
The following packages have been EXCLUDED:
  hedgewars 
0 upgraded, 0 reinstalled, 0 newly installed, 0 to remove, 1 not upgraded.
Done
$ LANG=C /usr/sbin/slapt-get -s --upgrade # removed from blacklist
Reading Package Lists...Done
The following packages will be upgraded:
  hedgewars 
1 upgraded, 0 reinstalled, 0 newly installed, 0 to remove, 0 not upgraded.
Need to get 0.0kB/114.9MB of archives.
After unpacking 366.8MB of additional disk space will be used.
hedgewars-0.9.13-x86_64-1ab is to be upgraded to version 0.9.16-x86_64-1ab
Done
The same goes for salix-update-notifier. Increased the check interval in .config/salix-update-notifier to 10s. In the first case no notification is displayed in the second case there is one.

Could you post the output of this command called as your user, when you get that issue again:

Code: Select all

LANG=C /usr/sbin/slapt-get -s --upgrade

BTW on a sidenote. This can be simplified:

Code: Select all

if [[ `LANG=C /usr/sbin/slapt-get -s --upgrade | grep "Need to get"` ]]
to

Code: Select all

if LANG=C /usr/sbin/slapt-get -s --upgrade | grep -q "Need to get"
The same goes for the other which (use >/dev/null 2>&1 here) and grep commands.

And instead of this:

Code: Select all

$HOME/.config
It might be a good idea to use XDG_CONFIG_HOME like JRD did for .cache:

Code: Select all

$([ -n "$XDG_CONFIG_HOME" ] && echo "$XDG_CONFIG_HOME" || echo "$HOME/.config")
Image
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: Double Noticed

Post by mimosa »

@JRD

I see xfce4-genmon-plugin is in the repos. I'd be interested in trying your script; perhaps you could post it here or send to me by PM?

In this case, as far as I know I haven't blacklisted anything (though I wish I had done so for Firefox, which took ages to update itself and seems a lot slower). It was a fresh install on a machine that is mostly used by other members of my family with a different OS;)
Post Reply