kde4systrayicon crashing on USB device plugging

Bug #1382384 reported by Mauro
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Back In Time
Fix Released
Medium
Germar

Bug Description

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:
- apparently no useful output on /var/log/syslog when the crash occurs (comment #11 on the other discussion)
- seems not to be bug #1332126. (I'm still experiencing this in 1.0.38 - see comment #11 on the other dicussion)
- tried the following:
# 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.

Revision history for this message
Germar (germar) wrote :

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

Revision history for this message
Mauro (mauromol) wrote :

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

Revision history for this message
Germar (germar) wrote :

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

Changed in backintime:
milestone: none → 1.0.40
status: New → Fix Committed
Revision history for this message
Mauro (mauromol) wrote :

Unfortunately, the crash happened again today :-(

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

Revision history for this message
Germar (germar) wrote :

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.

Revision history for this message
Mauro (mauromol) wrote :

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 (germar)
Changed in backintime:
status: Fix Committed → In Progress
importance: Undecided → Medium
assignee: nobody → Germar (germar)
Revision history for this message
Germar (germar) wrote :

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.

Revision history for this message
Mauro (mauromol) wrote :

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!

Revision history for this message
Germar (germar) wrote :

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.

Revision history for this message
Germar (germar) wrote :

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.

Revision history for this message
Mauro (mauromol) wrote :

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.

Revision history for this message
Germar (germar) wrote :

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

Revision history for this message
Mauro (mauromol) wrote :

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 (germar)
Changed in backintime:
milestone: 1.0.40 → 1.1.0
status: In Progress → Fix Committed
Revision history for this message
CaCO3 (caco3) wrote :

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)
Changed in backintime:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.