automoc4 processes lock again

Kostik Belousov kostikbel at gmail.com
Mon May 9 16:59:12 UTC 2011


On Mon, May 09, 2011 at 07:39:46PM +0400, Max Brazhnikov wrote:
> On Mon, 9 May 2011 15:41:05 +0300, Kostik Belousov wrote:
> > You did not supplied enough information.
> > Which of the processes is parent, which is child ?
> > Note that there are other threads in the pid 18636. What does they do ?
> 
> Here is backtraces from all threads http://people.freebsd.org/~makc/automoc4.bt
> 63373 is a parent now, 63374 is a child.
> 
> There were no related changes in Qt4 and automoc4 sources, probably my update from 8.2-PRERELEASE to STABLE a week ago triggered the issue.

It is obviously application bug, yes, I think my guess was right.
Thou shalt not call non-async safe functions in thy child of
multithreaded process.

Since it is a race, I see it more curious that it did not manifested
itself prevously.

> 
> > If you would allow me to make some guess, then I could assume that pid
> > 18640 is the child. Note that the child is waiting for the pthread
> > mutex locked which protects the stdio' FILE structure. Now, assume
> > additionally that the parent had the FILE locked in one thread while
> > another thread did the fork. Then, the child process would never be able
> > to obtain the lock because the lock was acquired by the thread that
> > exists no longer (in the child process, only the thread that called
> > fork is duplicated).
> > 
> > In fact, I believe that you already reported a similar problem with
> > malloc(3) some time ago. The root of the problem would be an undefined
> > (and permitted by POSIX) behaviour of calling non-async signal safe
> > functions in multithreaded process after fork.
> > 
> > For malloc(3), this can be argued to be a quality of the implementation
> > issue, but there is no reason to specially handle random mutexes, even
> > from libc. If the mutex was locked during the fork time, the protected
> > data structure is arguably in the inconsistent state after the fork in
> > the child.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20110509/5e11e757/attachment.pgp


More information about the freebsd-stable mailing list