[packagekit] Python fork() question

Robin Norwood rnorwood at redhat.com
Sat Mar 1 19:15:49 PST 2008


So,

The changes to the python dbus backend seem to be sortof working, but
I'm having one problem.

When I open pk-application, go to the groups tab, and click one after
the other, I quickly get into a situation where the backend signals the
next SearchGroup command before the thread that performed the last one
has finished exiting.  We certainly don't want two threads messing in
the yum DB at the same time, I added a retry, along with a delay.  The
logic works like this:

        retries = 0
        while self._child_is_running() and retries < 20:
            print "Method called, but a child is already running"
            time.sleep(1)
            retries += 1

_child_is_running() uses waitpid() to check to see if the child is
still running.

However, with this logic, I eventually get this error:

"""
The backend took too much time to process the synchronous request - you
need to fork!
"""

I'm not really sure why it takes so long (1 s?) for the child process
to exit...it exits right after calling Finished() - the yum is already
unlocked and everything.

It doesn't ever seem to take more than a second or two, so perhaps we
could just have the daemon wait a little longer...

Any ideas, smart people?

The good news is, other than this, the new backend seems to be working
well.

-RN

-- 
Robin Norwood
Red Hat, Inc.

"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching



More information about the PackageKit mailing list