M .Baz wrote:
Hello everybody.

We have a strange problem in an multi-threding application (Solaris10) that uses the gethostbyname_r function: sometimes, this operation enters in an infinite loop !!!.
The pstack trace shows that the last called function is _thr_setspecific_slow:

fdfc4ca8 _thr_setspecific_slow (b, 25f74c8, 0, b, fdec0200, fdff84b0) + 54
fdfc4d88 pthread_setspecific (0, 25f74c8, fdec0200, 5, fdfee2f4, b) + 78
fe695edc thr_get_storage (fe7266c8, 4, 2189cc, fe7266c8, e7010b00,25f74c8) + a4
fe6a1b50 __nderror (fe72b180, 0, fdff53c4, fe722da4, 812a4, fe72b199) + 58
fe6a6458 _get_hostserv_inetnetdir_byname (2618d40, fd3fec1c, fd3fec14, 
fe6c88c0, fe722da4, 0) + 178
fe6a3374 gethostbyname_r (417290, fd3ff0c0, fd3fecc0, 400, fd3feca0, 3) + a0
.
Looking into the source code of this function, I see these sentences:

296 nkeys = ((stsd = self->ul_stsd) != NULL)? stsd->tsd_nalloc : 8;
297 for (; key >= nkeys; nkeys  ... ( I can't post the rest of the line , 
arghhh !!!, please see the source code, it is a left shift of the nkeys 
variable...))
298 continue;

and this is the only sentence that can cause an infinite loop in this function. Is it possible that the value of nkeys will be zero ??? , in this case an infinite loop is guaranteed.

Thanks in advance ans sorry for my english.

Given the call location from thr_setspecific, I don't see how a key value of zero is possible - do you?

- Bart



--
Bart Smaalders                  Solaris Kernel Performance
ba...@cyber.eng.sun.com         http://blogs.sun.com/barts
"You will contribute more with mercurial than with thunderbird."
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to