[packagekit] pk_backend_finished race issue

Grzegorz Dąbrowski gdx at o2.pl
Thu Sep 13 14:13:29 PDT 2007


On Thu, 2007-09-13 at 20:07 +0200, Tom Parker wrote:
> I think I'm hitting a race issue in pk_backend_finished, like Grzegorz 
> was seeing in the box backend, but this time with the apt backend.
> 
> Running a search that you know only returns one result repeatedly 
> eventually (3-4 repeats tops) causes a crash with a crappy stacktrace, 
> even with all the debug symbols on and "G_DEBUG=fatal_criticals 
> G_SLICE=debug-blocks" set in the environment. Adding in a short delay 
> (.5s) before the pk_backend_finished removes the problem (>8 repeats, 
> all ok).
> 
> Richard? Anything more you can do to help this?

The crash is when thread is still running and g_module_close is called.
The problem is, we cannot really detect when thread ends. I was trying
to use g_async_queue_push in thread and g_async_queue_pop in the backend
module, but it doesn't help. I've found one solution, but I think it's
ugly:

1. At the end of thread set a global variable with exit code.
2. In a thread's caller wait for a valid exit code, e.g. while
(exit_code < 0) { sleep(something); }...
3. pk_backend_finished( with_valid_exit_code )

-- 
Grzegorz Dabrowski
Pingwinek GNU/Linux http://home.gna.org/pingwinek/




More information about the PackageKit mailing list