9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] notify woe
@ 2004-04-07  1:10 Bruce Ellis
  2004-04-07  1:40 ` William Josephson
  0 siblings, 1 reply; 4+ messages in thread
From: Bruce Ellis @ 2004-04-07  1:10 UTC (permalink / raw)
  To: 9fans

gee, don't call malloc from a notify function, this is from mk ...

acid: stk()
sleep()+0x7 /sys/src/libc/9syscall/sleep.s:5
lock(lk=0x188b8)+0x88 /sys/src/libc/port/lock.c:22
plock(p=0x17814)+0x12 /sys/src/libc/port/malloc.c:78
poolalloc(p=0x17814,n=0x1d)+0xf /sys/src/libc/port/pool.c:1096
malloc(size=0x15)+0x1c /sys/src/libc/port/malloc.c:199
wait()+0x87 /sys/src/libc/9sys/wait.c:22
waitfor(msg=0x7fffc600)+0x8 /sys/src/cmd/mk/plan9.c:144
waitup(retstatus=0x0,echildok=0x1)+0x5a /sys/src/cmd/mk/run.c:119
killchildren(msg=0x7fffc6e8)+0x59 /sys/src/cmd/mk/run.c:269
notifyf(msg=0x7fffc6e8)+0x7b /sys/src/cmd/mk/plan9.c:294
notifier+0x30 /sys/src/libc/port/atnotify.c:15

actually don't call wait, or any library function that allocates,
from a notify function.  how's my timing in interrupting a malloc?

brucee


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] notify woe
  2004-04-07  1:10 [9fans] notify woe Bruce Ellis
@ 2004-04-07  1:40 ` William Josephson
  2004-04-07  2:16   ` Bruce Ellis
  0 siblings, 1 reply; 4+ messages in thread
From: William Josephson @ 2004-04-07  1:40 UTC (permalink / raw)
  To: 9fans

On Wed, Apr 07, 2004 at 11:10:38AM +1000, Bruce Ellis wrote:
> gee, don't call malloc from a notify function, this is from mk ...
> 
> actually don't call wait, or any library function that allocates,
> from a notify function.  how's my timing in interrupting a malloc?

I seem to recall stumbling over that one a year or two
ago and mentioning it to the list or 9trouble.  Actually,
I think it was a race for the malloc lock, perhaps, that
could cause a deadlock in the thread library at interrupt
time.  Similar issue in any case...


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] notify woe
  2004-04-07  1:40 ` William Josephson
@ 2004-04-07  2:16   ` Bruce Ellis
  2004-04-07  3:28     ` William Josephson
  0 siblings, 1 reply; 4+ messages in thread
From: Bruce Ellis @ 2004-04-07  2:16 UTC (permalink / raw)
  To: 9fans

i believe this bug to be simply that a (in this case single threaded)
program is interrupted holding the malloc pool lock. the notify
function indirectly calls malloc. sleep time.

brucee
----- Original Message ----- 
From: "William Josephson" <jkw@eecs.harvard.edu>
To: <9fans@cse.psu.edu>
Sent: Wednesday, April 07, 2004 11:40 AM
Subject: Re: [9fans] notify woe


> On Wed, Apr 07, 2004 at 11:10:38AM +1000, Bruce Ellis wrote:
> > gee, don't call malloc from a notify function, this is from mk ...
> > 
> > actually don't call wait, or any library function that allocates,
> > from a notify function.  how's my timing in interrupting a malloc?
> 
> I seem to recall stumbling over that one a year or two
> ago and mentioning it to the list or 9trouble.  Actually,
> I think it was a race for the malloc lock, perhaps, that
> could cause a deadlock in the thread library at interrupt
> time.  Similar issue in any case...



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] notify woe
  2004-04-07  2:16   ` Bruce Ellis
@ 2004-04-07  3:28     ` William Josephson
  0 siblings, 0 replies; 4+ messages in thread
From: William Josephson @ 2004-04-07  3:28 UTC (permalink / raw)
  To: 9fans

On Wed, Apr 07, 2004 at 12:16:04PM +1000, Bruce Ellis wrote:
> i believe this bug to be simply that a (in this case single threaded)
> program is interrupted holding the malloc pool lock. the notify
> function indirectly calls malloc. sleep time.

Yep; that's the one (though I hit it somewhere inside
the thread scheduler and there's now a hack to mitigate
that particular instance).


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-04-07  3:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-07  1:10 [9fans] notify woe Bruce Ellis
2004-04-07  1:40 ` William Josephson
2004-04-07  2:16   ` Bruce Ellis
2004-04-07  3:28     ` William Josephson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).