Re: [Tracker] [Patch] New CVS version



Jamie McCracken wrote:
Laurent Aguerreche wrote:
Le mardi 22 aoÃt 2006 Ã 10:39 +0100, Jamie McCracken a Ãcrit :
Gergan Penkov wrote:
and trackerd does not exit, I haven't waited more than 5-10 minutes though.
Rats - I thought I sussed this one!

if it takes more then a few seconds to exit then its a deadlock on a mutex. I guess I should unlock them all as a precaution when exiting. Please try latest cvs again (I cannot replicate your problem mind you)
I found a case where it doesn't exit smoothly.

What I found:

in a thread, called thread1, tracker_log() is called to write "Watching
directory %s (total watches = %d)":
- g_print() to STDOUT, Ok;
- then,
  1/ lock()      <<====== important
  2/ open() on ~/.Tracker/tracker.log
- *BOOM*, user does a Ctrl+C, so this thread won't continue as
signal_handler() has been called and replaces prior code...
- now, tracker_log() is called to write "Received termination signal %d
so now exiting."
- g_print() to STDOUT, Ok;
- then,
  1/ lock()
  of course, it will wait for ever since this mutex is already locked
and won't be released...

At the same time, other threads will want to log something so they will
be locked.



Great thanks for that - it sure was a subtle one!

The right thing to do here is not to tracker_log anything until the second phase of the shutdown. (the resumption of code after the sig handler will allow the code to continue to unlock the mutex).


Have now altered CVS to fix this.

Also had a stab at improving the exiting (mostly guesswork) and increasing thread sync speed.


--
Mr Jamie McCracken
http://jamiemcc.livejournal.com/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]