Opened 12 years ago

Closed 12 years ago

#167 closed defect (fixed)

pynotify corrupted double-linked list?

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: major Milestone: 1.0
Component: Global Keywords:
Cc:

Description (last modified by Antoine Martin)

I have seen this sort of crash before (usually on shutdown with control-C), but this seems to happen during runtime which is more problematic...
The original bug (was on the wrong tracker) says this happens on clicking "Apply" in the options window (I assume the main 'Configuration' dialog - not the server options?).

I first thought that this was due to pybonjour, but the backtrace also seems to point to pynotify (and gio/dbus) - maybe we need an idle_add call on the notify path?

Attachments (5)

report.txt (19.0 KB) - added by Antoine Martin 12 years ago.
crash report
gdb.txt (3.7 KB) - added by Antoine Martin 12 years ago.
gdb backtrace
winswitch-dbus-notifications.patch (6.7 KB) - added by Antoine Martin 12 years ago.
use dbus for notification ahead of pynotify
gdb-report.txt (2.7 KB) - added by pmarek 12 years ago.
GDB report after patching
last-lines.txt (2.3 KB) - added by pmarek 12 years ago.
last lines after patching

Download all attachments as: .zip

Change History (19)

Changed 12 years ago by Antoine Martin

Attachment: report.txt added

crash report

Changed 12 years ago by Antoine Martin

Attachment: gdb.txt added

gdb backtrace

comment:1 Changed 12 years ago by Antoine Martin

Description: modified (diff)
Owner: changed from Antoine Martin to Antoine Martin
Status: newaccepted
Summary: pybonjour corrupted double-linked listgio corrupted double-linked list

comment:2 Changed 12 years ago by Antoine Martin

Description: modified (diff)

comment:3 Changed 12 years ago by Antoine Martin

Description: modified (diff)

comment:4 Changed 12 years ago by Antoine Martin

Summary: gio corrupted double-linked listpynotify corrupted double-linked list?

Please try the attached patch and let me know if that fixes it.

I think pynotify may be broken when used from within the gtk main loop - no idea why.
Using dbus directly (which is the underlying mechanism) seems to fix this problem.

Changed 12 years ago by Antoine Martin

use dbus for notification ahead of pynotify

comment:5 Changed 12 years ago by pmarek

I can reproduce that with debian testing/unstable.

ii  winswitch  0.12.6-1        Tool to start and control remote sessions,
ii  xpra       0.0.7.30+dfsg-1 tool to detach/reattach running X programs
# uname -a
Linux cacao 3.1.0-1-amd64 #1 SMP Thu Nov 3 19:35:59 UTC 2011 x86_64 GNU/Linux
Last edited 12 years ago by Antoine Martin (previous) (diff)

comment:6 Changed 12 years ago by Antoine Martin

Does the patch fix the problem? (you will need dbus-glib and dbus-python installed, probably are already)

comment:7 Changed 12 years ago by pmarek

After applying the patch I still get a crash.

Changed 12 years ago by pmarek

Attachment: gdb-report.txt added

GDB report after patching

Changed 12 years ago by pmarek

Attachment: last-lines.txt added

last lines after patching

comment:8 Changed 12 years ago by pmarek

Data above is after patching, when going into the configuration and unchecking the "start local server" flag => apply.

comment:9 Changed 12 years ago by Antoine Martin

Hah, this latest stacktrace now points to pybonjour and not py-notify..
Until I find a way to fix this, you should be able to workaround this particular crash by completely disabling mdns:

mdns_listener=False

in .winswitch/client/client.conf
and:

mDNS_publish=False

in .winswitch/server/server.conf

I would be very interested to hear if you still get the crash with/without the winswitch-dbus-notifications.patch patch above as this would give me a clear indication as to whether this is going in the right direction or not.

comment:10 Changed 12 years ago by pmarek

Without the patch I get this:

*** glibc detected *** /usr/bin/python: malloc(): smallbin double linked list corrupted: 0x000000000376da70 ***

When disabling mnds, it works, and the patch makes no difference.

Last edited 12 years ago by pmarek (previous) (diff)

comment:11 Changed 12 years ago by Antoine Martin

The dbus notification patch was accidentally applied as part of r4479 (oops)... Will test this further on all the platforms that use pynotify/dbus. Not reverting since I think it is worth having already as it reduces the glibc corruptions I have seen on shutdown.

The next part is to replace pybonjour (which is unmaintained...) with a dbus approach, at least for *nix platforms that have avahi/dbus.
Basically going back to the approach that existed in versions up to ~ 0.8.x: use avahi if present and fallback to pybonjour if not (osx, win32, ..)
Some pointers:

comment:12 Changed 12 years ago by Antoine Martin

r4481 re-instates the avahi bindings and seems to get rid of the double linked list corrupted issue here (although I was only seeing it on control-C shutdown - not during normal use)

Please let me know if that fixes it for you so I can make a new release with this fairly important crash fix.

Still TODO:

  • detect mdns_remove in avahi code (resolve_error?)
  • tell dbus we are no longer listening when shutting down
  • add python-avahi to deb/rpm dependency list
Last edited 12 years ago by Antoine Martin (previous) (diff)

comment:13 Changed 12 years ago by pmarek

$ apt-get remove winswitch
$ svn info
...
Revision: 4481
$ sudo python setup.py build
$ sudo python setup.py install
...
byte-compiling /usr/local/lib/python2.7/dist-packages/winswitch/ui/notification_util.py to notification_util.pyc
/usr/local/lib/python2.7/dist-packages/winswitch/ui/notification_util.py:148:
  SyntaxWarning: name 'haspynotify' is used prior to global declaration
  global haspynotify
byte-compiling /usr/local/lib/python2.7/dist-packages/winswitch/ui/quick_connect.py to quick_connect.pyc

winswitch_applet does now run without the check mark at "start local server", even if MDNS is activated again. And: it starts much faster!

Thanks a lot.

comment:14 Changed 12 years ago by Antoine Martin

Resolution: fixed
Status: acceptedclosed

Thanks for testing!
I will make a new release shortly with this fix.

Note: See TracTickets for help on using tickets.