Does this patch help?  It seems like only the parent should
attempt the lock.  I will try it out for a while.  --mark--

--- /usr/bin/hp-systray.orig    2011-03-18 11:01:58.000000000 -0700
+++ /usr/bin/hp-systray 2011-03-18 11:04:40.000000000 -0700
@@ -82,7 +82,10 @@
             log.warn("No hp: or hpfax: devices found in any installed CUPS 
queue. Exiting.")
             sys.exit(1)

-    mod.lockInstance()
+    # only attempt the lock if this pid is the session leader,
+    # otherwise it creates a race condition where children get there first
+    if os.getpgid(os.getpid()) == os.getpid():
+        mod.lockInstance()

     r1, w1 = os.pipe()
     log.debug("Creating pipe: hpssd (%d) ==> systemtray (%d)" % (w1, r1))

--- /usr/bin/hp-systray.orig	2011-03-18 11:01:58.000000000 -0700
+++ /usr/bin/hp-systray	2011-03-18 11:04:40.000000000 -0700
@@ -82,7 +82,10 @@
             log.warn("No hp: or hpfax: devices found in any installed CUPS queue. Exiting.")
             sys.exit(1)
 
-    mod.lockInstance()
+    # only attempt the lock if this pid is the session leader,
+    # otherwise it creates a race condition where children get there first
+    if os.getpgid(os.getpid()) == os.getpid():
+        mod.lockInstance()
     
     r1, w1 = os.pipe()
     log.debug("Creating pipe: hpssd (%d) ==> systemtray (%d)" % (w1, r1))

Reply via email to