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

kde4systrayicon crashing on USB device plugging #132

Closed
Germar opened this issue Oct 11, 2015 · 14 comments
Closed

kde4systrayicon crashing on USB device plugging #132

Germar opened this issue Oct 11, 2015 · 14 comments
Milestone

Comments

@Germar
Copy link
Member

Germar commented Oct 11, 2015

I have a BTRFS multi-volume (two partitions) file system on the same hard drive connected to the system through a USB docking station. This file system is used as the target device for backups. Backups are scheduled to be run at most once per day when the device is plugged in.

Often (not always) BIT systray icon crashes as soon as I plug in the USB device. Backups are started successfully though.

Here is the last backtrace I took, after installing the debug symbols my Linux Mint 17 (based on Ubuntu 14.04) could retrieve:
http://pastebin.ubuntu.com/8575852/

This issue was originally discussed as part of: https://answers.launchpad.net/backintime/+question/254140 (see from comment #7 on).

Things tried so far:

python

import os, sys, subprocess
cmd = [ sys.executable, '/usr/share/backintime/kde4/kde4systrayicon.py', '1' ]
p = subprocess.Popen( cmd, env = {'HOME': os.environ['HOME']} )
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated. please move it to /home/mauro/.config/fontconfig/fonts.conf manually
INFO: [kde4systrayicon] begin loop
p.terminate()

sudo -H python

import os, sys, subprocess
cmd = [ sys.executable, '/usr/share/backintime/kde4/kde4systrayicon.py', '1' ]
p = subprocess.Popen( cmd, env = {'HOME': os.environ['HOME']} )
No protocol specified
kde4systrayicon.py: cannot connect to X server :0.0
p.terminate()

Additional information:
My configuration is particular: the use of two volumes for the same BTRFS file system caused the issue described in question #254140, which was fixed only after applying your patch mentioned in comment #17 of that question.
I have to try again to see if the crash occurs after applying that patch, because I'm not sure the last time it occurred was before or after having applied that patch. I will let you know.

Also, it might be useful to know that I have two different profiles (one for my normal user, "mauro", and one for root) both scheduled to be executed on USB device connection, both writing to that BTRFS volume (on different target folders, of course). I don't know if they may interfere with each on other and cause the KDE systray icon to crash.

The problem does not happen always, but most of the times.


Imported from Launchpad using lp2gh.

@Germar
Copy link
Member Author

Germar commented Oct 11, 2015

(by germar)
Please try out the attached patch with 'sudo patch /usr/share/backintime/kde4/kde4systrayicon.py < kde4systrayicon.diff'

@Germar
Copy link
Member Author

Germar commented Oct 11, 2015

(by mauromol)
Hi Germar,
I verified that this crash occurs even after applying the patch for the UUID issue.

Now I've applied your latest patch in comment #1 and this evening I could attach the USB device and see BIT tray icon + backup process start without any crash! Well done!
Now I'm going to try again during the next few days to see if the crash occurs again, but I'm optimistic :-)

@Germar
Copy link
Member Author

Germar commented Oct 11, 2015

(by germar)
Thanks for the feedback. I told you, UUID issue has nothing to do with this ;-)

@Germar
Copy link
Member Author

Germar commented Oct 11, 2015

(by mauromol)
Unfortunately, the crash happened again today :-(

Here is the new backtrace:
http://pastebin.ubuntu.com/8646016/

@Germar
Copy link
Member Author

Germar commented Oct 11, 2015

(by germar)
Sorry for the inconvenience. I'm not used to this kind of backtracks. So I'm a little blind here.

Please add this patch, too (keep the old one). This should catch the exception and exit the Systray Icon cleanly instead. Please monitor your /var/log/syslog for this string in the next days:
[kde4systrayicon] failed to create KApplication

This should give a more meaningful response of the error.

@Germar
Copy link
Member Author

Germar commented Oct 11, 2015

(by mauromol)
Patch applied, device connected, tray icon crashed but no such output produced in /var/log/syslog :-(

Please note this: when I connect the USB device, BIT is triggered (I know because the tray icon crashes!), but the filesystem is not yet mounted (it should mount automatically, but I don't know why this does not always work, at least with BTRFS disks). Could be this the problem (i.e.: BIT fails to do something because the device is plugged in but the target filesystem is not yet available)?

@Germar
Copy link
Member Author

Germar commented Oct 11, 2015

(by germar)
I'm really sorry for the mess. Please try this patch, too.

Do you mean the meassage "Can't find snapshots folder. If it is on a removable drive please plug it."?
This is because HDDs need some time to spin up. This can take up to 10-20sec.

Which BIT version do you use right now? Please upgrade to 1.0.38 from PPA as I changed take_snapshot to always wait for the HDD to come up in that version (it could have failed before). Don't forget to apply the patches again after upgrading.

@Germar
Copy link
Member Author

Germar commented Oct 11, 2015

(by mauromol)
I'm already on 1.0.38. The message you mention actually appeared the only time BIT didn't crash, while it does not show up when it crashes (it seems like the crash happens before the tray icon has even the chance to show this message).
I'm going to try your latest patch as soon as possible. Thank you!

@Germar
Copy link
Member Author

Germar commented Oct 11, 2015

(by germar)
Tray icon does not handle that message. That's done with 'notify-send'. But it could be that the crash in tray icon plugin also killed init of notify plugin.

I assume it crashes because KApplication is trying to use DBus session bus but couldn't connect to. In 1.1 series I recently found out, that the session bus is already initialised during first import of any dependency which it self imports dbus library. But as the environ variable 'DBUS_SESSION_BUS_ADDRESS' is not set in that early state it will fail and won't work in the whole process.

During writing this lines I realised that the last patch will also not solve the issue :-D
I tried to load the environ before import KApplication. But to do so I need to import tools and this will import dbus which again will lead to an invalid DBus session bus.

Forget about the last patch and try this one instead please.

@Germar
Copy link
Member Author

Germar commented Oct 11, 2015

(by germar)
Oh. Right after posting this I was finally able to catch that shy bug in the wild by my self :-D

But that also mean again that kde4systrayicon4.diff does not help :-(

But the good news is, I now have something to play with.

@Germar
Copy link
Member Author

Germar commented Oct 11, 2015

(by mauromol)
Hi Germar, just to let you know that I stopped applying patches because of your message #10.
Let me know if I should try something all the same.

@Germar
Copy link
Member Author

Germar commented Oct 11, 2015

(by germar)
Hi Mauro,
would it be okay for you to upgrade to the dev version of 1.1.0? I tried several things to fix this in 1.0.38 without luck. But 1.1.0 doesn't have this bug because it doesn't use KDE anymore (it's now pure Qt4).

1.1.0 is not finished yet but it is running stable. You can install it from ppa:bit-team/testing

I'd really like to go on to finish 1.1.0 instead of duck-taping 1.0.38 ;-)

Regards,
Germar

@Germar
Copy link
Member Author

Germar commented Oct 11, 2015

(by mauromol)
That's fine for me Germar, so don't worry. As soon as I have some spare time I'll update and let you know how it goes.

@Germar
Copy link
Member Author

Germar commented Oct 11, 2015

(by caco3)
With BiT 1.0.34 I also had the kde4systrayicon crash when running it as root (or anachron or chron).
With 1.1.0~alpha05 it seems to work now.

@Germar Germar added this to the 1.1.0 milestone Oct 11, 2015
@Germar Germar closed this as completed Oct 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant