Calling dbus from Apache and getting the X11 initialization error.
John Palmieri
johnp at redhat.com
Mon Jan 4 09:21:25 PST 2010
----- "Thiago Macieira" <thiago at kde.org> wrote:
> Em Segunda-feira 28. Dezembro 2009, às 04.04.48, Mike MacHenry
> escreveu:
> > I am looking for a work around to the "Autolaunch error: X11
> > initialization failed." that it seems a lot of forums have
> discussions
> > about. There have been suggests to solve this problem by setting
> the
> > DISPLAY environment variable, but this does not work for me. I
> think
> > because that trick works for cron jobs but not Apache processes.
> > Here's the simple description of my problem:
> >
> > I have a DBus server process running. It has an interface with one
> > method, skip_ahead, which has no arguments. I run the following
> Python
> > code from a normal user's account:
>
> If that's the system bus that you're talking about, then the X11
> initialisation should not happen. The address of the system bus is
> known.
>
> But I doubt you're talking about the system bus. You're probably
> talking about
> the session bus.
>
> To access the session bus, you must have the address of the bus and
> the proper
> UID. The address is given by the DBUS_SESSION_BUS_ADDRESS environment
>
> variable, that is set by dbus-launch at the start of the session and
> is shared
> by all processes in that session. If you don't have that variable set,
> your
> process probably doesn't belong to the session in the first place
> (Apache
> processes certainly look like they don't belong).
>
> If the environment variable isn't set, the library tries to use
> something else
> that is also keyed to the session and that's the X11 display. Your
> process is
> apparently not able to connect to X11 either.
>
> So, please ask yourself: does your process belong to the session or
> not?
>
> If it doesn't, you probably want to use the system bus.
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Senior Product Manager - Nokia, Qt Development Frameworks
> PGP/GPG: 0x6EF45358; fingerprint:
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
>
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dbus
I would also suggest perhaps setting up a special bus for apache apps to use when talking to your module or, for performance reasons, having the module accept direct connections using the bus APIs. As Thiago suggested, using a session bus is wrong here. They are primarily designed for use with X Sessions. The system bus could be used for simplicity but it is really designed for use with system specific services, not for isolated environments like an apache module.
--
John (J5) Palmieri
Software Engineer
Red Hat, Inc.
More information about the dbus
mailing list