bit-team / backintime

Back In Time - An easy-to-use backup tool for GNU Linux using rsync in the back
https://backintime.readthedocs.io
GNU General Public License v2.0
2.02k stars 198 forks source link

BAckintime crash when screen locked #14

Closed Germar closed 8 years ago

Germar commented 8 years ago

Using up to date Sidux. Seems to occur when unattended and screen has locked, Functions normal when computer in use. Thanks.

Application: Back In Time (backintime.py), signal: Segmentation fault
[KCrash Handler]
5  0x00007f201fdc2404 in QWidget::metric(QPaintDevice::PaintDeviceMetric) const () from /usr/lib/libQtGui.so.4
6  0x00007f201ff0ea4a in QFont::QFont(QFont const&, QPaintDevice*) () from /usr/lib/libQtGui.so.4
7  0x00007f201fd84654 in QWidgetPrivate::updateFont(QFont const&) () from /usr/lib/libQtGui.so.4
8  0x00007f201fd8458c in QWidgetPrivate::resolveFont() () from /usr/lib/libQtGui.so.4
9  0x00007f201fd8f3ea in QWidget::setParent(QWidget*, QFlags<Qt::WindowType>) () from /usr/lib/libQtGui.so.4
10 0x00007f201fd8f712 in QWidget::setParent(QWidget*) () from /usr/lib/libQtGui.so.4
11 0x00007f201fd94dc6 in QWidgetAction::releaseWidget(QWidget*) () from /usr/lib/libQtGui.so.4
12 0x00007f2020132c9f in QMenu::~QMenu() () from /usr/lib/libQtGui.so.4
13 0x00007f201cb750bb in KMenu::~KMenu() () from /usr/lib/libkdeui.so.5
14 0x00007f201cb22e0e in KSystemTrayIcon::~KSystemTrayIcon() () from /usr/lib/libkdeui.so.5
15 0x00007f201d2730ee in sipKSystemTrayIcon::~sipKSystemTrayIcon() () from /usr/lib/pymodules/python2.5/PyKDE4/kdeui.so
16 0x00007f201d25223d in ?? () from /usr/lib/pymodules/python2.5/PyKDE4/kdeui.so
17 0x00007f2022addf79 in ?? () from /usr/lib/pymodules/python2.5/sip.so
18 0x000000000045e0d5 in ?? ()
19 0x0000000000445b33 in ?? ()
20 0x000000000045e15c in ?? ()
21 0x0000000000445b33 in ?? ()
22 0x000000000042249c in ?? ()
23 0x00000000004387c2 in ?? ()
24 0x0000000000445b33 in ?? ()
25 0x000000000042249c in ?? ()
26 0x00000000004458cb in PyDict_Clear ()
27 0x0000000000445909 in ?? ()
28 0x00000000004ba3de in ?? ()
29 0x00000000004baab4 in PyGC_Collect ()
30 0x00000000004aeed1 in Py_Finalize ()
31 0x00000000004ae94e in ?? ()
32 0x00000000004aeb4d in PyErr_PrintEx ()
33 0x00000000004af85b in PyRun_SimpleFileExFlags ()
34 0x0000000000414572 in Py_Main ()
35 0x00007f202619e5c6 in __libc_start_main () from /lib/libc.so.6
36 0x00000000004139d9 in _start ()

Imported from Launchpad using lp2gh.

Germar commented 8 years ago

(by cliff6056) Now, I have no idea if the following applies, but the explanation seems to fit: that when the display is active, backintime-kde works fine, however, when the display is not, it fails with no backup, and the systray icon remains frozen in place. Also, when the systray icon is frozen, a mouseover message as follows: "Compare with snapshot 2009-10-05 19:00 :01 (rsync:>F++++++++++++++++++ etx/X11/Xwrapper.config)".

My skill level is such that I have no idea if the above or below information is useful in detecting the Segmentation Fault problem originally posted or if it is related, however, hope it of assistance if anyone else has this problem. Should also point out that if I install backintime-gnome on the kde system, no systray icon ever appears, and subsequently, backintime does not experience any issues, and is the solution I use at this time.

The following is quoted from the le-web.org site: http://www.le-web.org/2008/11/06/pygtk-how-to-display-a-systray-icon-from-a-cronjob/.

PyGTK: How to display a systray icon from a cronjob

It is nice to give some user feedback when someting happen in a background application. For example when a cronjob is running it would be nice to show a systray icon.

When the cron-job runs the DISPLAY environment variable is not defined so your gtk application can’t access to xserver. So before importing pygtk you should check if DISPLAY is defined. If not just define it to default value “:0.0″.

import os

if DISPLAY is not set, then set it to default ':0.0'

if len( os.getenv( 'DISPLAY', '' ) ) == 0: os.putenv( 'DISPLAY', ':0.0' )

import pygtk pygtk.require("2.0")

But what happens if your gtk application really can’t connect to the xserver (xserver is not runnig, you are not logged in …). In this case your application should not try to use xserver related functions. For example when I try to use gtk.StatusIcon the application ends with a segmentation fault.

To check if your application can access to xserver just get the default display. If it is None then you can’t access it.

display = gtk.gdk.display_get_default() if not display is None: ...

Now, putting all together I made this simple application: notify.py.

import os

if DISPLAY is not set, then set it to default ':0.0'

if len( os.getenv( 'DISPLAY', '' ) ) == 0: os.putenv( 'DISPLAY', ':0.0' )

import pygtk pygtk.require("2.0") import gtk import threading import time

GTK main loop thread

class GTKMainThread(threading.Thread): def run(self): gtk.main()

get default display. None means it can't connect to xserver

display = gtk.gdk.display_get_default() statusIcon = None

if the display is not None show status icon

if not display is None:

start a gtk loop in another thread

gtk.gdk.threads_init()
GTKMainThread().start()
try:
    statusIcon = gtk.StatusIcon()
    statusIcon.set_from_stock( gtk.STOCK_INFO )
    statusIcon.set_visible( True )
    statusIcon.set_tooltip(_("Back In Time: take snapshot ..."))
except:
    pass

do something here

print "Begin" time.sleep( 5 ) #wait 5 seconds print "End"

hide status icon

if not statusIcon is None: statusIcon.set_visible( False )

quit GTK main look

if not display is None: gtk.main_quit()

Try it:

python notify.py

Now to try it from cron, you can add it in you crontab to be called every 10 minutes (use full path to notify.py):

( crontab -l; echo "0 * * * * python /FULLPATH/notify.py" ) | crontab - ( crontab -l; echo "10 * * * * python /FULLPATH/notify.py" ) | crontab - ( crontab -l; echo "20 * * * * python /FULLPATH/notify.py" ) | crontab - ( crontab -l; echo "30 * * * * python /FULLPATH/notify.py" ) | crontab - ( crontab -l; echo "40 * * * * python /FULLPATH/notify.py" ) | crontab - ( crontab -l; echo "50 * * * * python /FULLPATH/notify.py" ) | crontab -

Check your crontab:

crontab -l

you should see the lines with “python /FULLPATH/notify.py”.

To remove it from your crontab just call:

crontab -l | grep -v notify.py | crontab -

Tags: cron, Linux, pygtk, python, systray

This entry was posted on Thursday, November 6th, 2008 at 1:51 pm and is filed under Linux, Python/PyGTK, Tips, Tricks & Scripts. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Germar commented 8 years ago

(by bratdaking) Are more people experiencing this bug?

Notify.py is implemented for the GTK (GNOME version) of backintime indeed, however I guess the KDE version fails to detect if the xserver is running or not and whether there is a display, (KDE does not use GTK). What might be the solution is to implement the notify solutions also in the KDE version, however I am not an expert on KDE and have not really a clue how to do that...

Cheers, Bart

2009/10/6 cliff6056

Now, I have no idea if the following applies, but the explanation seems to fit: that when the display is active, backintime-kde works fine, however, when the display is not, it fails with no backup, and the systray icon remains frozen in place. Also, when the systray icon is frozen, a mouseover message as follows: "Compare with snapshot 2009-10-05 19:00 :01 (rsync:>F++++++++++++++++++ etx/X11/Xwrapper.config)".

My skill level is such that I have no idea if the above or below information is useful in detecting the Segmentation Fault problem originally posted or if it is related, however, hope it of assistance if anyone else has this problem. Should also point out that if I install backintime-gnome on the kde system, no systray icon ever appears, and subsequently, backintime does not experience any issues, and is the solution I use at this time.

The following is quoted from the le-web.org site: http://www.le- web.org/2008/11/06/pygtk-how-to-display-a-systray-icon-from-a-cronjob/.

PyGTK: How to display a systray icon from a cronjob

It is nice to give some user feedback when someting happen in a background application. For example when a cronjob is running it would be nice to show a systray icon.

When the cron-job runs the DISPLAY environment variable is not defined so your gtk application can’t access to xserver. So before importing pygtk you should check if DISPLAY is defined. If not just define it to default value “:0.0″.

import os

if DISPLAY is not set, then set it to default ':0.0'

if len( os.getenv( 'DISPLAY', '' ) ) == 0: os.putenv( 'DISPLAY', ':0.0' )

import pygtk pygtk.require("2.0")

But what happens if your gtk application really can’t connect to the xserver (xserver is not runnig, you are not logged in …). In this case your application should not try to use xserver related functions. For example when I try to use gtk.StatusIcon the application ends with a segmentation fault.

To check if your application can access to xserver just get the default display. If it is None then you can’t access it.

display = gtk.gdk.display_get_default() if not display is None: ...

Now, putting all together I made this simple application: notify.py.

import os

if DISPLAY is not set, then set it to default ':0.0'

if len( os.getenv( 'DISPLAY', '' ) ) == 0: os.putenv( 'DISPLAY', ':0.0' )

import pygtk pygtk.require("2.0") import gtk import threading import time

GTK main loop thread

class GTKMainThread(threading.Thread): def run(self): gtk.main()

get default display. None means it can't connect to xserver

display = gtk.gdk.display_get_default() statusIcon = None

if the display is not None show status icon

if not display is None:

start a gtk loop in another thread

   gtk.gdk.threads_init()
   GTKMainThread().start()
   try:
           statusIcon = gtk.StatusIcon()
           statusIcon.set_from_stock( gtk.STOCK_INFO )
           statusIcon.set_visible( True )
           statusIcon.set_tooltip(_("Back In Time: take snapshot ..."))
   except:
           pass

do something here

print "Begin" time.sleep( 5 ) #wait 5 seconds print "End"

hide status icon

if not statusIcon is None: statusIcon.set_visible( False )

quit GTK main look

if not display is None: gtk.main_quit()

Try it:

python notify.py

Now to try it from cron, you can add it in you crontab to be called every 10 minutes (use full path to notify.py):

( crontab -l; echo "0 * * * * python /FULLPATH/notify.py" ) | crontab - ( crontab -l; echo "10 * * * * python /FULLPATH/notify.py" ) | crontab - ( crontab -l; echo "20 * * * * python /FULLPATH/notify.py" ) | crontab - ( crontab -l; echo "30 * * * * python /FULLPATH/notify.py" ) | crontab - ( crontab -l; echo "40 * * * * python /FULLPATH/notify.py" ) | crontab - ( crontab -l; echo "50 * * * * python /FULLPATH/notify.py" ) | crontab -

Check your crontab:

crontab -l

you should see the lines with “python /FULLPATH/notify.py”.

To remove it from your crontab just call:

crontab -l | grep -v notify.py | crontab -

Tags: cron, Linux, pygtk, python, systray

This entry was posted on Thursday, November 6th, 2008 at 1:51 pm and is filed under Linux, Python/PyGTK, Tips, Tricks & Scripts. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

BAckintime crash when screen locked https://bugs.launchpad.net/bugs/441628 You received this bug notification because you are a member of Back In Time Team, which is the registrant for Back In Time.

Germar commented 8 years ago

(by cliff6056)

Germar commented 8 years ago

(by bratdaking) Hello everybody,

Cliff6065 suggested that an old bug was actually quite similar to a bug he experienced, and more recently Sergiom99. That is why I linked all those old bug reports to this one, in the hope we can solve it quite soon. My question is: are you all still encountering this Tray Icon bug also in the newest release 0.9.26?

Cheers, Bart

Germar commented 8 years ago

(by cliff6056) Yes in KDE4.3.2.

Bart de Koning wrote:

Hello everybody,

Cliff6065 suggested that an old bug was actually quite similar to a bug he experienced, and more recently Sergiom99. That is why I linked all those old bug reports to this one, in the hope we can solve it quite soon. My question is: are you all still encountering this Tray Icon bug also in the newest release 0.9.26?

Cheers, Bart

Germar commented 8 years ago

(by bratdaking) Hey Dan,

What was the main problem, and how did you solve this?

Cheers, Bart

2009/12/2 Dan

Germar commented 8 years ago

(by danleweb) Hi Bard,

The crash happens in KDE4 plugin (KSystemTrayIcon). Qt/KDE like to have the message loop in the main thread. As a GUI plugin I tried to put it into another thread. Gnome plugin behave OK but the KDE4 crashes (not always). I changed the KDE4 plugin to start another process for displaying the icon.

Regards, Dan

Germar commented 8 years ago

(by yehaa) I installed the "testing" version yesterday. Today I find the following status:

For me this bug seems to not be completely fixed. The backup is finished, though. So the bug is not as severe as it was.

Or do you think this is a new bug?

Germar commented 8 years ago

(by kap4lin) I was told (some time back) to post my log to this bug. My actual post is here: https://answers.launchpad.net/backintime/+question/91217

I tried to setup an hourly cron job with the "Smart Remove" option checked. This hourly job was setup around 6.20 pm on 20 Dec. So, the immediate next job at 7 pm ran making relevant backups. The log looks like this:

+++++++++++++++++++++++++++++++++++++++++++++++++ Dec 20 19:00:01 nebu backintime (apoc): INFO: Lock Dec 20 19:00:01 nebu backintime (apoc): INFO: Include folders: ['/home/apoc/.config', '/home/apoc/.emacs.d'... long list...] Dec 20 19:00:01 nebu backintime (apoc): INFO: Ignore folders: [] Dec 20 19:00:01 nebu backintime (apoc): INFO: Last snapshots: {} Dec 20 19:00:01 nebu backintime (apoc): INFO: [KDE4Plugin.Systray.run] Dec 20 19:00:02 nebu backintime (apoc): INFO: Compare with old snapshot: 20091220-171809 Dec 20 19:00:02 nebu backintime (apoc): INFO: [KDE4Plugin.Systray.run] begin loop Dec 20 19:00:09 nebu backintime (apoc): INFO: Command "rsync -aEAX -i --dry-run --chmod=Fa-w,D+w --whole-file --delete --exclude="/media/wd500g1/Home" --exclude="/home/apoc/.local .... long list .... Dec 20 19:00:09 nebu backintime (apoc): INFO: Create hard-links Dec 20 19:00:13 nebu backintime (apoc): INFO: Command "cp -al "/media/wd500g1/Home/backintime/20091220-171809/backup/"* "/media/wd500g1/Home/backintime/new_snapshot/backup/"" returns Dec 20 19:00:13 nebu backintime (apoc): INFO: Call rsync to take the snapshot Dec 20 19:00:20 nebu backintime (apoc): INFO: Command "rsync -aEAX -v --delete-excluded --chmod=Fa-w,D+w --whole-file --delete --exclude="/media/wd500g1/Home" --exclude="/home/apo Dec 20 19:00:20 nebu backintime (apoc): INFO: Save permissions Dec 20 19:00:37 nebu backintime (apoc): INFO: Remove backups older than: 19991220-000000 Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep all >= 20091219-000000 Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep first >= 20091207-000000 and < 20091214-000000 Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep first >= 20091130-000000 and < 20091207-000000 Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep first >= 20090101-000000 and < 20090201-000000 Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep first >= 20090201-000000 and < 20090301-000000 Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep first >= 20090301-000000 and < 20090401-000000 Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep first >= 20090401-000000 and < 20090501-000000 Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep first >= 20090501-000000 and < 20090601-000000 Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep first >= 20090601-000000 and < 20090701-000000 Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep first >= 20090701-000000 and < 20090801-000000 Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep first >= 20090801-000000 and < 20090901-000000 Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep first >= 20090901-000000 and < 20091001-000000 Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep first >= 20091001-000000 and < 20091101-000000 Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep first >= 20091101-000000 and < 20091201-000000 Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep snapshots: ['20091220-190001', '20091220-171809', '20091130-053029'] Dec 20 19:00:37 nebu backintime (apoc): INFO: [smart remove] keep snapshot: 20091107-023119, it has a name Dec 20 19:00:37 nebu backintime (apoc): INFO: Keep min free disk space: 1024 Mb Dec 20 19:00:39 nebu backintime (apoc): INFO: [KDE4Plugin.Systray.run] end loop Dec 20 19:00:39 nebu backintime (apoc): INFO: Unlock +++++++++++++++++++++++++++++++++++++++++++++++++

Then after at evey hour, the process to start up, but fails without doing any backup. The output looks like this...

+++++++++++++++++++++++++++++++++++++++++++++++++ Dec 20 20:00:01 nebu /USR/SBIN/CRON[14400]: (apoc) CMD (nice -n 19 /usr/bin/backintime --backup-job >/dev/null 2>&1) Dec 20 20:00:02 nebu backintime (apoc): INFO: Lock Dec 20 20:00:02 nebu backintime (apoc): INFO: Include folders: ['/home/apoc/.config', '/home/apoc/.emacs.d'.... long list ...] Dec 20 20:00:02 nebu backintime (apoc): INFO: Ignore folders: [] Dec 20 20:00:02 nebu backintime (apoc): INFO: Last snapshots: {} Dec 20 20:00:02 nebu backintime (apoc): INFO: Compare with old snapshot: 20091220-190001 Dec 20 20:00:02 nebu backintime (apoc): INFO: [KDE4Plugin.Systray.run] Dec 20 20:00:03 nebu backintime (apoc): INFO: [KDE4Plugin.Systray.run] begin loop

... some other logs ...

Dec 20 21:00:01 nebu /USR/SBIN/CRON[15848]: (apoc) CMD (nice -n 19 /usr/bin/backintime --backup-job >/dev/null 2>&1) Dec 20 21:00:02 nebu backintime (apoc): WARNING: A backup is already running ++++++++++++++++++++++++++++++++++++++++++++++++++

And this "already running" warning log keeps repeating every hour. These process keep on running (as seen from top). Also there is an icon in the system tray.

++++++++++++++++++++++++++++++++++++++++++++++++++ /bin/sh -c nice -n 19 /usr/bin/backintime --backup-job >/dev/null 2>&1 /bin/sh /usr/bin/backintime --backup-job python /usr/share/backintime/common/backintime.py --backup-job sh -c rsync -aEAX -i --dry-run --chmod=Fa-w,D+w --whole-file --delete --exclude="/media/wd500g1/Home" --exclude="/ rsync -aEAX -i --dry-run --chmod=Fa-w,D+w --whole-file --delete --exclude=/media/wd500g1/Home --exclude=/home/apoc/.l rsync -aEAX -i --dry-run --chmod=Fa-w,D+w --whole-file --delete --exclude=/media/wd500g1/Home --exclude=/home/apoc/.l rsync -aEAX -i --dry-run --chmod=Fa-w,D+w --whole-file --delete --exclude=/media/wd500g1/Home --exclude=/home/apoc/.l +++++++++++++++++++++++++++++++++++++++++++++++++++

If I kill these process the systray icon goes away, but at the next hour, the 'Lock' output appears in syslog again and ends with the already running warning log. The systray icon reappears and stays like that...

Germar commented 8 years ago

(by danleweb) There was a merge problem. Please try beta6 version (testing repository).

Germar commented 8 years ago

(by yehaa) I, for myself, seem to not suffer from this bug anymore. Thank you.

Germar commented 8 years ago

(by cliff6056) Hi Dan. I am using 0.9.99beta6 and the backup file itself seems to be working fine. However, I am just testing on a small file at 5 minute intervals, having done 5 backups, the first manual, the remaining automatically by scheduler. I now have five icons of backintime running in the tray, a mouseover says "Finalizing" on all. Hmm, make that six icons now.

Thanks for you assistance.

Cliff

Germar commented 8 years ago

(by yusuf-martin) Same here, also with beta6.

Martin

Germar commented 8 years ago

(by gabor-sunseaker) I filed a bug (bug 506876) that turned out to be a duplicate of this so I've been directed here.

@Jan Schnackenberg, can you say what you did that resolved the problem for you?

I use openSUSE 11.2 and see that there is no packaged 0.9.99beta6 for me so I'll try build it from source. I cannot find the beta 6 source. All I can find are the sources that refer to revision 666. It this what I should use?

Germar commented 8 years ago

(by danleweb) There only Ubuntu package available for version 0.9.99beta. You need to get sources from bzr: "bzr checkout lp:backintime"

Germar commented 8 years ago

(by yehaa) As I use Kubuntu, all I did was use the provided beta-package.

jan commented 8 years ago

@Germar @Jan summons the mighty user Jan to join this conversation.