Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Aug 1999 20:43:33 -0400
From:      Dan Moschuk <dan@trinsec.com>
To:        hackers@freebsd.org
Subject:   gethostbyaddr() and threads.
Message-ID:  <19990808204333.A40377@trinsec.com>

next in thread | raw e-mail | index | archive | help

Greetings,

After quite an exhausting night (of all the ways I didn't want to spend my
Sunday...) I've managed to track down a problem that has been frustrating me
all night.  The problem exists with multiple threads calling gethostbyaddr()
(not necessarily at the same time).  

Here's a debug output from my program:

Thread 134978048 sleeping...
Thread 134978560 sleeping...
Thread 134978048 awakened!
Thread 134978048 checking status of 162.18.75.91
Thread 134978048 looking up 162.18.75.91
Thread 134978048 calling gethostbyaddr()
Thread 134978560 awakened!
Thread 134978560 checking status of 162.18.75.91
Thread 134978560 sleeping...
Thread 134978560 awakened!
Thread 134978560 checking status of 202.188.127.2
Thread 134978560 looking up 202.188.127.2
Thread 134978560 calling gethostbyaddr()
Thread 134978560 finished gethostbyaddr()
Thread 134978560 checking status of 200.231.47.8
Thread 134978560 looking up 200.231.47.8
Thread 134978560 calling gethostbyaddr()

As you can see, gethostbyaddr() when called from the first thread never 
returns, while the last thread continues on.  This happens no matter how
many threads I create.  Creating 200 threads produces much longer debug output,
but the result is the same, the first 199 threads created never return from
gethostbyaddr(), while the last one continues on its merry way.

I am hoping someone can shed a little more light on this subject, and possibly
explain why this is happening and perhaps how to fix it.

I've tested this on both -stable and -current branches.


Regards,

Dan


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990808204333.A40377>