[Lldb-commits] [PATCH] D38938: Logging: provide a way to safely disable logging in a forked process

2017-10-15 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision. We had a bug where if we had forked (in the ProcessLauncherPosixFork) while another thread was writing a log message, we would deadlock. This happened because the fork child inherited the locked log rwmutex, which would never get unlocked. This meant the child got stu

Re: [Lldb-commits] [PATCH] D38938: Logging: provide a way to safely disable logging in a forked process

2017-10-15 Thread Zachary Turner via lldb-commits
Doesn’t DisableAllLogChannels acquire a scoped lock? If so wouldn’t it just release at the end of the function? On Sun, Oct 15, 2017 at 2:42 PM Pavel Labath via Phabricator < revi...@reviews.llvm.org> wrote: > labath created this revision. > > We had a bug where if we had forked (in the ProcessLau

Re: [Lldb-commits] [PATCH] D38938: Logging: provide a way to safely disable logging in a forked process

2017-10-15 Thread Pavel Labath via lldb-commits
On 15 October 2017 at 23:04, Zachary Turner wrote: > Doesn’t DisableAllLogChannels acquire a scoped lock? If so wouldn’t it just > release at the end of the function? The thing is, it is unable to acquire the lock in the first place, because the mutex is already "locked". So, the sequence of eve

Re: [Lldb-commits] [PATCH] D38938: Logging: provide a way to safely disable logging in a forked process

2017-10-15 Thread Zachary Turner via lldb-commits
what are we using fork for, out of curiosity? It seems pretty hard to make this work. Logging isn’t the only thing in the program that might be holding a mutex, so it seems like this could still happen. Seems like mixing fork and mutexes is just a fundamentally bad idea, unless I’m missing somet

Re: [Lldb-commits] [PATCH] D38938: Logging: provide a way to safely disable logging in a forked process

2017-10-15 Thread Pavel Labath via lldb-commits
On 15 October 2017 at 23:59, Zachary Turner wrote: > what are we using fork for, out of curiosity? It seems pretty hard to make > this work. Logging isn’t the only thing in the program that might be > holding a mutex, so it seems like this could still happen. > > Seems like mixing fork and mutex