Re: threaded, forked, rethreaded processes will deadlock

2009-03-18 Thread Kostik Belousov
On Thu, Jan 22, 2009 at 12:42:56AM -0500, Daniel Eischen wrote: On Wed, 21 Jan 2009, David Schultz wrote: I think there *is* a real bug here, but there's two distinct ways to fix it. When a threaded process forks, malloc acquires all its locks so that its state is consistent after a fork.

Re: threaded, forked, rethreaded processes will deadlock

2009-03-18 Thread Daniel Eischen
On Wed, 18 Mar 2009, Kostik Belousov wrote: I looked at the issue once more recently, and I propose the following much less intrusive patch. It is somewhat hackish, but I think that it would be good to have this working. Most other Unixes do have working thread library after the fork. Any

Re: threaded, forked, rethreaded processes will deadlock

2009-03-18 Thread David Xu
Kostik Belousov wrote: I looked at the issue once more recently, and I propose the following much less intrusive patch. It is somewhat hackish, but I think that it would be good to have this working. Most other Unixes do have working thread library after the fork. Any objections ? diff --git

Re: threaded, forked, rethreaded processes will deadlock

2009-01-26 Thread Brian Fundakowski Feldman
On Thu, Jan 22, 2009 at 12:42:56AM -0500, Daniel Eischen wrote: On Wed, 21 Jan 2009, David Schultz wrote: I think there *is* a real bug here, but there's two distinct ways to fix it. When a threaded process forks, malloc acquires all its locks so that its state is consistent after a fork.

Re: threaded, forked, rethreaded processes will deadlock

2009-01-21 Thread Brian Fundakowski Feldman
On Mon, Jan 19, 2009 at 07:41:35PM -0500, Brian Fundakowski Feldman wrote: On Fri, Jan 16, 2009 at 02:36:06PM -0800, Jason Evans wrote: Brian Fundakowski Feldman wrote: Could you, and anyone else who would care to, check this out? It's a regression fix but it also makes the code a

Re: threaded, forked, rethreaded processes will deadlock

2009-01-21 Thread Daniel Eischen
On Wed, 21 Jan 2009, Brian Fundakowski Feldman wrote: On Mon, Jan 19, 2009 at 07:41:35PM -0500, Brian Fundakowski Feldman wrote: On Fri, Jan 16, 2009 at 02:36:06PM -0800, Jason Evans wrote: Brian Fundakowski Feldman wrote: Could you, and anyone else who would care to, check this out? It's a

Re: threaded, forked, rethreaded processes will deadlock

2009-01-21 Thread David Schultz
I think there *is* a real bug here, but there's two distinct ways to fix it. When a threaded process forks, malloc acquires all its locks so that its state is consistent after a fork. However, the post-fork hook that's supposed to release these locks fails to do so in the child because the child

Re: threaded, forked, rethreaded processes will deadlock

2009-01-21 Thread Daniel Eischen
On Wed, 21 Jan 2009, David Schultz wrote: I think there *is* a real bug here, but there's two distinct ways to fix it. When a threaded process forks, malloc acquires all its locks so that its state is consistent after a fork. However, the post-fork hook that's supposed to release these locks

Re: threaded, forked, rethreaded processes will deadlock

2009-01-21 Thread David Schultz
On Thu, Jan 22, 2009, Daniel Eischen wrote: On Wed, 21 Jan 2009, David Schultz wrote: I think there *is* a real bug here, but there's two distinct ways to fix it. When a threaded process forks, malloc acquires all its locks so that its state is consistent after a fork. However, the

Re: threaded, forked, rethreaded processes will deadlock

2009-01-21 Thread David Schultz
On Thu, Jan 22, 2009, David Schultz wrote: If you can't implement functions that are required to be async-signal-safe like fork() and exec() without malloc(), then for now I guess we should go for something along the lines of what Brian is proposing. If the app programmer has taken special

Re: threaded, forked, rethreaded processes will deadlock

2009-01-19 Thread Brian Fundakowski Feldman
On Fri, Jan 16, 2009 at 02:36:06PM -0800, Jason Evans wrote: Brian Fundakowski Feldman wrote: Could you, and anyone else who would care to, check this out? It's a regression fix but it also makes the code a little bit clearer. Thanks! Index: lib/libc/stdlib/malloc.c Why does malloc

Re: threaded, forked, rethreaded processes will deadlock

2009-01-16 Thread Brian Fundakowski Feldman
On Fri, Jan 09, 2009 at 09:39:08AM -0800, Julian Elischer wrote: Brian Fundakowski Feldman wrote: On Thu, Jan 08, 2009 at 11:09:16PM -0800, Julian Elischer wrote: Brian Fundakowski Feldman wrote: On Thu, Jan 08, 2009 at 10:44:20PM -0500, Daniel Eischen wrote: On Thu, 8 Jan 2009, Brian

Re: threaded, forked, rethreaded processes will deadlock

2009-01-16 Thread Jason Evans
Brian Fundakowski Feldman wrote: Could you, and anyone else who would care to, check this out? It's a regression fix but it also makes the code a little bit clearer. Thanks! Index: lib/libc/stdlib/malloc.c Why does malloc need to change for this? Unless there's a really good reason, I

Re: threaded, forked, rethreaded processes will deadlock

2009-01-09 Thread Daniel Eischen
On Fri, 9 Jan 2009, Brian Fundakowski Feldman wrote: On Thu, Jan 08, 2009 at 10:44:20PM -0500, Daniel Eischen wrote: On Thu, 8 Jan 2009, Brian Fundakowski Feldman wrote: It appears that the post-fork hooks for malloc(3) are somewhat broken such that when a threaded program forks, and then

Re: threaded, forked, rethreaded processes will deadlock

2009-01-09 Thread Brian Fundakowski Feldman
On Thu, Jan 08, 2009 at 11:09:16PM -0800, Julian Elischer wrote: Brian Fundakowski Feldman wrote: On Thu, Jan 08, 2009 at 10:44:20PM -0500, Daniel Eischen wrote: On Thu, 8 Jan 2009, Brian Fundakowski Feldman wrote: It appears that the post-fork hooks for malloc(3) are somewhat broken such

Re: threaded, forked, rethreaded processes will deadlock

2009-01-09 Thread Julian Elischer
Brian Fundakowski Feldman wrote: On Thu, Jan 08, 2009 at 11:09:16PM -0800, Julian Elischer wrote: Brian Fundakowski Feldman wrote: On Thu, Jan 08, 2009 at 10:44:20PM -0500, Daniel Eischen wrote: On Thu, 8 Jan 2009, Brian Fundakowski Feldman wrote: It appears that the post-fork hooks for

Re: threaded, forked, rethreaded processes will deadlock

2009-01-09 Thread Kostik Belousov
On Fri, Jan 09, 2009 at 11:34:26AM -0500, Brian Fundakowski Feldman wrote: On Thu, Jan 08, 2009 at 11:09:16PM -0800, Julian Elischer wrote: Brian Fundakowski Feldman wrote: On Thu, Jan 08, 2009 at 10:44:20PM -0500, Daniel Eischen wrote: On Thu, 8 Jan 2009, Brian Fundakowski Feldman wrote:

Re: threaded, forked, rethreaded processes will deadlock

2009-01-09 Thread Brian Fundakowski Feldman
On Fri, Jan 09, 2009 at 07:42:32PM +0200, Kostik Belousov wrote: On Fri, Jan 09, 2009 at 11:34:26AM -0500, Brian Fundakowski Feldman wrote: On Thu, Jan 08, 2009 at 11:09:16PM -0800, Julian Elischer wrote: Brian Fundakowski Feldman wrote: On Thu, Jan 08, 2009 at 10:44:20PM -0500, Daniel

threaded, forked, rethreaded processes will deadlock

2009-01-08 Thread Brian Fundakowski Feldman
It appears that the post-fork hooks for malloc(3) are somewhat broken such that when a threaded program forks, and then its child attempts to go threaded, it deadlocks because it already appears to have locks held. I am not familiar enough with the current libthr/libc/rtld-elf interaction that

Re: threaded, forked, rethreaded processes will deadlock

2009-01-08 Thread Daniel Eischen
On Thu, 8 Jan 2009, Brian Fundakowski Feldman wrote: It appears that the post-fork hooks for malloc(3) are somewhat broken such that when a threaded program forks, and then its child attempts to go threaded, it deadlocks because it already appears to have locks held. I am not familiar enough

Re: threaded, forked, rethreaded processes will deadlock

2009-01-08 Thread Dan Nelson
In the last episode (Jan 08), Daniel Eischen said: On Thu, 8 Jan 2009, Brian Fundakowski Feldman wrote: It appears that the post-fork hooks for malloc(3) are somewhat broken such that when a threaded program forks, and then its child attempts to go threaded, it deadlocks because it already

Re: threaded, forked, rethreaded processes will deadlock

2009-01-08 Thread Brian Fundakowski Feldman
On Thu, Jan 08, 2009 at 10:44:20PM -0500, Daniel Eischen wrote: On Thu, 8 Jan 2009, Brian Fundakowski Feldman wrote: It appears that the post-fork hooks for malloc(3) are somewhat broken such that when a threaded program forks, and then its child attempts to go threaded, it deadlocks

Re: threaded, forked, rethreaded processes will deadlock

2009-01-08 Thread Tim Kientzle
Brian Fundakowski Feldman wrote: On Thu, Jan 08, 2009 at 10:44:20PM -0500, Daniel Eischen wrote: On Thu, 8 Jan 2009, Brian Fundakowski Feldman wrote: It appears that the post-fork hooks for malloc(3) are somewhat broken such that when a threaded program forks, and then its child attempts to

Re: threaded, forked, rethreaded processes will deadlock

2009-01-08 Thread Julian Elischer
Brian Fundakowski Feldman wrote: On Thu, Jan 08, 2009 at 10:44:20PM -0500, Daniel Eischen wrote: On Thu, 8 Jan 2009, Brian Fundakowski Feldman wrote: It appears that the post-fork hooks for malloc(3) are somewhat broken such that when a threaded program forks, and then its child attempts to