python dbus bindings and threads segfault

Bug #13639 reported by Cms-ruinedsoft
10
Affects Status Importance Assigned to Milestone
dbus (Debian)
Fix Released
Unknown
dbus (Ubuntu)
Fix Released
Medium
Matthias Klose

Bug Description

Threaded python applications segfault using the latest version in Hoary.

I will have an attachment for an example. The fault occurs when gtk.main() is
reached.

This might be fixed in upstream, I haven't tried it.

It could be I'm not calling the functions properly, if this is the case, sorry
to waste your time.

https://bugs.freedesktop.org/show_bug.cgi?id=1844: https://bugs.freedesktop.org/show_bug.cgi?id=1844

Revision history for this message
Cms-ruinedsoft (cms-ruinedsoft) wrote :

Threaded python applications segfault using the latest version in Hoary.

I will have an attachment for an example. The fault occurs when gtk.main() is
reached.

This might be fixed in upstream, I haven't tried it.

It could be I'm not calling the functions properly, if this is the case, sorry
to waste your time.

Revision history for this message
Cms-ruinedsoft (cms-ruinedsoft) wrote :

Created an attachment (id=1548)
A simple dbus object service

Open up a terminal and run ./testserv.py.

Test the server by opening up a terminal and running python with the following
commands:
>>> import dbus
>>> b = dbus.Bus(dbus.Bus.TYPE_SESSION, False)
>>> s = b.get_service("com.test")
>>> o = s.get_object("/SimpleServ", "com.test")
>>> o.ping()
>>> o.threadone()

SimpleServ Segfaults for me on linux-686-smp when threading is enabled.

Commenting out all the thread initialization references makes the program run
properly, but calling o.threadone() doesn't work as expected (its execution
doesn't start until gtk.main() has ended).

Revision history for this message
Matthias Klose (doko) wrote :

with python2.3-dbus and python2.3-gtk packages built from our current sources, I
get the same error as with python2.4.

the dbus bindings are compiled without -fno-strict-aliasing, showing many
warnings about type-punned pointers.

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-ID: <email address hidden>
Date: Wed, 17 Nov 2004 13:49:47 +0100
From: Martin Hamrle <email address hidden>
To: <email address hidden>
Subject: Python crashes when using dbus with threads

Package: python2.3-dbus
Version: 0.22-3

This script crashes:

import gtk
import dbus
gtk.threads_init()
dbus.Bus(dbus.Bus.TYPE_SYSTEM)
gtk.main()

Installed packages:
python2.3 2.3.4-13
python2.3-dbus 0.22-3
python2.3-dev 2.3.4-13
python2.3-glad 2.2.0-3
python2.3-gnom 2.0.3-1
python2.3-gtk2 2.2.0-3
python2.3-imag 1.1.4-3
python2.3-xml 0.8.3-5

dbus-1 0.22-3
dbus-1-dev 0.22-3
dbus-1-utils 0.22-3
dbus-glib-1 0.22-3
dbus-glib-1-de 0.22-3

libglib2.0-0 2.4.7-1
libc6 2.3.2.ds1-18
libc6-i686 2.3.2.ds1-18

Revision history for this message
In , Sjoerd Simons (sjoerd) wrote : bug 281710 is forwarded to https://bugs.freedesktop.org/show_bug.cgi?id=1844

# Automatically generated email from bts, devscripts version 2.8.14
forwarded 281710 https://bugs.freedesktop.org/show_bug.cgi?id=1844

Revision history for this message
Debian Bug Importer (debzilla) wrote :

Message-Id: <email address hidden>
Date: Wed, 30 Mar 2005 23:19:36 +0200
From: Sjoerd Simons <email address hidden>
To: <email address hidden>
Subject: bug 281710 is forwarded to https://bugs.freedesktop.org/show_bug.cgi?id=1844

# Automatically generated email from bts, devscripts version 2.8.14
forwarded 281710 https://bugs.freedesktop.org/show_bug.cgi?id=1844

Revision history for this message
anthony baxter (anthony) wrote :

I've attached a fix to fd.org bug #8581. I have no idea if/when they're going to
cut a new 0.23.x release, but if they don't, I'd really really urge you to cut a
bugfix release anyway. The bug is pretty critical - any python program that uses
threads and d-bus will segfault (the d-bus bindings needed calls to the
Py_GILState_Ensure/Release functions.

Revision history for this message
Matthias Klose (doko) wrote :

Matt, Martin,

the patch should be applied to hoary-updates, if possible.

Revision history for this message
Matt Zimmerman (mdz) wrote :

Can someone attach the patch here for review?

Revision history for this message
Matthias Klose (doko) wrote :

Created an attachment (id=2929)
patch

Revision history for this message
Matthias Klose (doko) wrote :

please reassign after review

Revision history for this message
Matt Zimmerman (mdz) wrote :

The patch looks good to me, OK for hoary-updates.

Revision history for this message
Matthias Klose (doko) wrote :

fixed in dbus 0.23.4-0ubuntu4 (hoary-updates) and dbus (0.34-1ubuntu2) breezy

Revision history for this message
In , Sjoerd Simons (sjoerd-spring) wrote : Fixed in recent versions

Package: dbus
Version: 0.36.1-1

On Wed, Mar 30, 2005 at 11:19:36PM +0200, Sjoerd Simons wrote:
> # Automatically generated email from bts, devscripts version 2.8.14
> forwarded 281710 https://bugs.freedesktop.org/show_bug.cgi?id=1844

Apparently this was fixed some time ago by upstream

  Sjoerd
--
Brahma said: Well, after hearing ten thousand explanations, a fool is no
wiser. But an intelligent man needs only two thousand five hundred.
  -- The Mahabharata

Revision history for this message
In , Pierre Habouzit (madcoder) wrote : btspull automated mail
Download full text (115.6 KiB)

user <email address hidden>
forwarded 85437 http://bugs.kde.org/show_bug.cgi?id=20186
tags 85437 + upstream fixed-upstream
usertags 85437 + status-CLOSED resolution-FIXED
tags 223708 + upstream fixed-upstream
usertags 223708 + status-CLOSED resolution-FIXED
forwarded 85443 http://bugs.kde.org/show_bug.cgi?id=20187
tags 85443 + upstream fixed-upstream
usertags 85443 + status-CLOSED resolution-FIXED
forwarded 100894 http://bugs.kde.org/show_bug.cgi?id=6184
tags 100894 + upstream
usertags 100894 + status-NEW
tags 215400 + upstream
usertags 215400 + status-NEW
tags 94567 + upstream wontfix
usertags 94567 + status-RESOLVED resolution-WONTFIX
forwarded 101379 http://bugs.kde.org/show_bug.cgi?id=32192
tags 101379 - wontfix
tags 101379 + upstream
usertags 101379 + status-UNCONFIRMED
usertags 154184 + status-RESOLVED resolution-FIXED
forwarded 102462 http://bugs.kde.org/show_bug.cgi?id=35918
usertags 102462 + status-UNCONFIRMED
forwarded 262988 http://bugzilla.kernel.org/show_bug.cgi?id=4532
tags 262988 + upstream fixed-upstream
usertags 262988 + status-CLOSED resolution-CODE_FIX
tags 132860 + upstream wontfix
usertags 132860 + status-RESOLVED resolution-WONTFIX
usertags 226824 + status-ASSIGNED
tags 221999 + upstream fixed-upstream
usertags 221999 + status-RESOLVED resolution-WORKSFORME
forwarded 103201 http://bugs.kde.org/show_bug.cgi?id=28072
tags 103201 + fixed-upstream
usertags 103201 + status-RESOLVED resolution-FIXED
usertags 169092 + status-NEW
tags 251067 + upstream
usertags 251067 + status-NEW
tags 144907 + upstream
usertags 144907 + status-ASSIGNED
forwarded 111358 http://bugs.kde.org/show_bug.cgi?id=35921
tags 111358 + upstream fixed-upstream
usertags 111358 + status-CLOSED resolution-FIXED
usertags 297529 + status-NEW
tags 223738 + upstream fixed-upstream
usertags 223738 + status-RESOLVED resolution-WORKSFORME
forwarded 116824 http://bugs.kde.org/show_bug.cgi?id=35926
usertags 116824 + status-RESOLVED resolution-WONTFIX
tags 180740 + upstream
usertags 180740 + status-REOPENED
usertags 169146 + status-NEW
tags 223928 + upstream fixed-upstream
usertags 223928 + status-RESOLVED resolution-WORKSFORME
usertags 190690 + status-UNCONFIRMED
tags 266542 + upstream
usertags 266542 + status-NEW
forwarded 116826 http://bugs.kde.org/show_bug.cgi?id=22723
usertags 116826 + status-NEW
tags 311758 + upstream
usertags 311758 + status-RESOLVED resolution-CODE_FIX
tags 303074 + upstream fixed-upstream
usertags 303074 + status-RESOLVED resolution-WORKSFORME
tags 196814 + upstream
usertags 196814 + status-NEW
tags 48602 + upstream wontfix
usertags 48602 + status-RESOLVED resolution-WONTFIX
tags 201323 + upstream
usertags 201323 + status-NEW
tags 238290 + upstream
usertags 238290 + status-NEW
forwarded 231017 https://bugzilla.icculus.org/show_bug.cgi?id=952
usertags 231017 + status-ASSIGNED
usertags 321403 + status-ASSIGNED
forwarded 118834 http://bugs.kde.org/show_bug.cgi?id=35938
usertags 118834 + status-NEW
usertags 200342 + status-NEW
tags 206744 + fixed-upstream
usertags 206744 + status-RESOLVED resolution-FIXED
tags 280412 + fixed-upstream
usertags 280412 + status-RESOLVED resolution-FIXED
tags 310141 + upstream
usertags 310141 + statu...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Patches

Remote bug watches

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