dimahardie / google-breakpad

Automatically exported from code.google.com/p/google-breakpad
0 stars 0 forks source link

WriteMinidump on Mac is not reenterable #421

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.  call google_breakpad::ExceptionHandler::WriteMinidump twice

What is the expected output? What do you see instead?
First call locks the mutex two times - before and after call to 
SendMessageToHandlerThread. Dumper thread unlocks first lock, then mutex is 
locked again and never unlocked further. Second call to WriteMinidump deadlocks 
on first lock.

What version of the product are you using? On what operating system?
SVN trunk r736, Mac OS X.

Please provide any additional information below.
Possible patch attached.

Original issue reported on code.google.com by mike.dld on 16 Mar 2011 at 2:06

Attachments:

GoogleCodeExporter commented 8 years ago
This was my patch.

Original comment by norman.juchler@dacuda.com on 27 Sep 2011 at 3:04

Attachments:

GoogleCodeExporter commented 8 years ago
I had same thought on using condition waiting, but then I realized it would be 
easier fixing it the way I did in the end :)

There's a catch with conditional variable: pthread_cond_wait unlocks the mutex, 
so child thread should first lock it, then do the job, then signal, then unlock 
it so pthread_cond_wait could lock it back. Otherwise you can't guarantee that 
signal will be sent *after* you start waiting, which could lead to another 
deadlock. You have everything except the lock in child thread. Hope I'm right 
on that point, it drives me crazy sometimes :-P

Another thing I was trying to solve with the patch is potentionally 
inconsistent value of use_minidump_write_mutex_ since it's being set to true 
before mutex is actually locked.

Original comment by mike.dld on 27 Sep 2011 at 3:32

GoogleCodeExporter commented 8 years ago
And umm, could you please clean your patch so it doesn't contain unchanged 
parts (ignoring whitespace)? Would be nice ;)

Original comment by mike.dld on 27 Sep 2011 at 3:39

GoogleCodeExporter commented 8 years ago
Lol, could you please just fix it, since 2015 already

Original comment by dron...@gmail.com on 30 Mar 2015 at 3:57