Python decorators on dbus hotplugging

Rendy Anthony rendy.anthony at flightfocus.net
Thu Oct 23 08:13:37 PDT 2008


Hi,

You need to add "gobject.threads_init()" before running your mainloop if
you use threading in your application. This enables threading in the
gobject module.

Hope it helps.

Regards,
Rendy Anthony

On Thu, 2008-10-23 at 16:08 +0200, Frank Aune wrote:
> Hello,
> 
> I'm using python threaded decorators around my hotplugging methods for an 
> application communicating with HAL over dbus to intercept hotplugging events. 
> The sole reason for the decorators is to prevent the application GUI 
> from "freezing" during a hotplugging event. On my slowish laptop the 
> application works fine, but on faster machines it will sooner or later crash 
> (actually more sooner than later).
> 
> Please find attached a working sample which is designed to trigger the 
> behaviour. To make it work "properly", comment out the @threaded line before 
> deviceAdded and deviceRemoved. To see the erratic behaviour I'm experiencing 
> comment in the @threaded lines and start hotplugging. 
> 
> USB almost always works (I actually don't recollect if I've gotten any faults 
> from an USB hotplugging event) - PCCards for example will constantly produce 
> segmentation faults. You can pretty much hotplug any PCMCIA PCcard a couple 
> of times and get the erratic behaviour. It ranges from:
> 
> - not detecting the event
> - detects the event, but not able to extract the device properties
> - HAL Complaints about missing devices
> - Segmentation faults
> 
> It's seems as if the deviceAdded thread dies half-way through execution, since 
> it doesn't print out all statements.
> 
> I've attached a backtrace.log which shows a stack dump during a segfault. I 
> would very much like to get some feedback about why this is happening, what 
> I'm doing wrong and possible workarounds/fixes.
> 
> In advance,
> Thank!
> 
> -Frank
> 
> System: Ubuntu 8.04 LTS
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus



More information about the dbus mailing list