[mod_python] mod_python + dbus ?

Graham Dumpleton grahamd at dscpl.com.au
Mon Jul 3 20:20:49 EDT 2006

Panard wrote ..
> Le mardi 04 juillet 2006 00:33, Graham Dumpleton a écrit :
> > Panard wrote ..
> >
> > > Hi,
> > >
> > > I'm tring to use a running dbus service with mod_python. The service
> runs
> > > fine, a python cgi script uses it fine, but a mod_python script doesn't
> > > respond...
> > > .....
> >
> > What version of Apache are you using and what MPM is compiled into it,
> > ie., prefork or worker? What version of mod_python are you using?
> I'm using apache 2.0.58, with worker mpm, and mod_python 3.1.4.

Using "worker" with mod_python 3.1.4 is a bad idea as there are some
multithreading bugs in that version of mod_python. You should at least
upgrade to mod_python 3.2.8 which fixes them. Better still, wait a few days
and hopefully 3.2.9 will be out, which has other changes related to the
threading and simplified GIL API which might allow dbus to work (but also
may not).

> Thanks for all your comments. I'll try to look at this probably threading
> problem... (but I'm practically sure that dbus python wrappers are thread
> aware, there is a dbus.glib.threads_init() method...)

As I said, it is a bit more complicated than that ... :-)

> > That said, are you wanting to use dbus because you specifically want
> to
> > talk to an existing application which is already implemented with support
> > for dbus, or were you after a general messaging framework that could
> > be used from Apache/mod_python and you were going to be implementing
> > everything from scratch?
> Well, I'm implementing everything from scratch. But I would like to have
> a 
> message framework quite "standard".

Hmmm, I wouldn't have thought that dbus is any more standard than any
other solution. It also still isn't at version 1.0 and they say in documentation
that until 1.0 that the API may vary. That it is targeted at desktop applications
also may not make it as useful as other solutions for general programming
of applications having requirements for distributed processing or remote
monitoring and control.

> The main goal is to be able to manage a running python application on the
> server hosting a mod_python web-page (ask for stopping the application,
> get 
> the list active tasks, ask for doing some new tasks, etc...).

Have you ever considered simply embedding an XML-RPC server in your
application and making XML-RPC requests from inside of mod_python.
The description of your application doesn't suggest there is going to be
much requests going to the application, so the per connection cost of
using XML-RPC isn't going to make any difference. In other words, doesn't
seem like a connected messaging system solution is going to give you
any additional benefit for the possible extra complexity.

> > If you are starting from scratch, I can perhaps suggest another system
> > which is known to work from Apache/mod_python and does cope with
> > all the problems of multiple interpreters and multithreading that it
> > presents and which makes things complicated.
> Yes! I'm waiting for your suggestions :)

Yes it is self promotion, but as I said, I know it is a solution which will
work. The package I was going to suggest was OSE.


Python wrappers documentation at:


Python cookbook recipes.


Example of integration with mod_python:


>From what you describe though, both OSE and dbus are probably overkill,
although OSE would make it relatively simple to do. Use of a simple a
XML-RPC server in your application would possibly be a much simpler

If you have considered XML-RPC, would be interested to hear why you
think it isn't an adequate solution.


> Thanks a lot.
> Panard
> -- 
> HomePage: http://dev.inzenet.org/~panard/
> Yzis : http://www.yzis.org
> Qomics : http://dev.inzenet.org/~panard/qomics
> Smileys : http://smileys.inzenet.org
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list