Launching A Truly Disjoint Process

Ami Tavory atavory at
Sun Mar 11 22:01:01 CET 2012


  I'm encountering a problem using the multiprocessing module to create a
process that is truly disjoint from the parent process: i.e., one that
contains no "memory" of the parent process, nor any record in the parent
process that it is its child. This originated in a pygtk problem, but I'll
try to put down as little pygtk as possible - just enough to explain the
problem (also, sorry, but I couldn't get an answer at the gtk forum).

  The code is a small python debugger front-end for GEdit. The plugin code,
run from GEdit's process, uses
<code>multiprocessing.Process(target = run_dbg)</code>
to launch the debugger in a function in separate process. The debugger uses
the bdb module like this:
<code>'execfile("%s")' % script)</code>.
  This seems to work fine, except if the script being debugged is itself a
pygtk script. Specifically, if it contains the code
then GEdit crashes with
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not
been called
[xcb] Aborting, sorry about that.
gedit: ../../src/xcb_io.c:273: poll_for_event: Assertion
`!xcb_xlib_threads_sequence_lost' failed.
  Googling this error yielded many results, but they all consisted of
advice to change either the code launching the process (possibly compiling
it differently), or change the launched process running gtk. It seems like
gtk requires that a single thread run this. Unfortunately, in this case,
the launching process is GEdit (whose code I cannot modify from a plugin),
and the launched process essentially runs a hypothetical script that is
being debugged (and whose code, therefore, is a given).
  OTOH, clearly it is possible to run more than a single gtk app
concurrently from completely separate processes. Is there a way, therefore,
to launch the second process, or have the launched process do something
when it starts, so that the two processes should essentially be disjoint?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list