From: Zoran V. <zv...@ar...> - 2005-10-08 09:20:05
|
No luck: this (NetBSD) system does not have any MT-safe call. What I did: During the configure I emit the warning if compiling under Darwin. checking for getaddrinfo in -lsocket... no checking for getnameinfo in -lsocket... no checking for getaddrinfo... yes checking for getnameinfo... yes checking for gethostbyname_r... no checking for gethostbyaddr_r... no configure: WARNING: DNS queries will use non-threadsafe calls which could result in server instability In dns.c I added #ifdef __APPLE__ Ns_Cs cs; Ns_CsEnter(&cs); ... Ns_CsLeave(&cs); #endif to cope with this *at least* within our own program. This does not guarantee that this is MT-safe because any of the rest of the system may call those calls anytime, hence we get problems anyways. Zoran |
From: Stephen D. <sd...@gm...> - 2005-10-08 21:22:13
|
On 10/8/05, Zoran Vasiljevic <zv...@ar...> wrote: > No luck: this (NetBSD) system does not have any MT-safe call. > What I did: > > During the configure I emit the warning if compiling under Darwin. > > checking for getaddrinfo in -lsocket... no > checking for getnameinfo in -lsocket... no > checking for getaddrinfo... yes > checking for getnameinfo... yes > checking for gethostbyname_r... no > checking for gethostbyaddr_r... no > configure: WARNING: DNS queries will use non-threadsafe calls which > could result in server instability > > In dns.c I added > > #ifdef __APPLE__ > Ns_Cs cs; > Ns_CsEnter(&cs); > ... > Ns_CsLeave(&cs); > #endif > > to cope with this *at least* within our own program. This does not > guarantee that this is MT-safe because any of the rest of the > system may call those calls anytime, hence we get problems anyways. This doesn't seem to work on my Linux system (Fedora Core 4): dns.c: In function 'GetHost': dns.c:264: error: 'struct sockaddr_in' has no member named 'sin_len' |
From: Zoran V. <zv...@ar...> - 2005-10-08 21:43:45
|
Am 08.10.2005 um 23:22 schrieb Stephen Deasey: > > This doesn't seem to work on my Linux system (Fedora Core 4): > > dns.c: In function 'GetHost': > dns.c:264: error: 'struct sockaddr_in' has no member named 'sin_len' > Rats! This is absolutely bad. I recon we'D have to make something ugly as: #ifdef __APPLE__ static Ns_Cs cs; Ns_CsEnter(&cs); memset(&sa, 0, sizeof(struct sockaddr_in)); sa.sin_family = AF_INET; sa.sin_len = sizeof(struct sockaddr_in); #else memset(&sa, 0, sizeof(struct sockaddr_in)); sa.sin_family = AF_INET; #endif W/o this explicit sin_len setup, the thing is just not working on Darwin... Should I check this in? BTW: it is the latest 10.4.2 Darwin release. Zoran |
From: Stephen D. <sd...@gm...> - 2005-10-08 21:25:22
|
On 10/8/05, Zoran Vasiljevic <zv...@ar...> wrote: > No luck: this (NetBSD) system does not have any MT-safe call. > What I did: > > During the configure I emit the warning if compiling under Darwin. > > checking for getaddrinfo in -lsocket... no > checking for getnameinfo in -lsocket... no > checking for getaddrinfo... yes > checking for getnameinfo... yes > checking for gethostbyname_r... no > checking for gethostbyaddr_r... no > configure: WARNING: DNS queries will use non-threadsafe calls which > could result in server instability > > In dns.c I added > > #ifdef __APPLE__ > Ns_Cs cs; > Ns_CsEnter(&cs); > ... > Ns_CsLeave(&cs); > #endif > > to cope with this *at least* within our own program. This does not > guarantee that this is MT-safe because any of the rest of the > system may call those calls anytime, hence we get problems anyways. btw. is this the case with the latest OSX release? I seem to remember they updated the unix stuff, replacing a lot of the original NetBSD infrastructure with newer FreeBSD. Maybe the answer is to only support OSX >=3D 10.x, is that's possible...? |
From: Stephen D. <sd...@gm...> - 2005-10-17 01:42:49
|
On 10/8/05, Zoran Vasiljevic <zv...@ar...> wrote: > No luck: this (NetBSD) system does not have any MT-safe call. > What I did: > > During the configure I emit the warning if compiling under Darwin. > > checking for getaddrinfo in -lsocket... no > checking for getnameinfo in -lsocket... no > checking for getaddrinfo... yes > checking for getnameinfo... yes > checking for gethostbyname_r... no > checking for gethostbyaddr_r... no > configure: WARNING: DNS queries will use non-threadsafe calls which > could result in server instability > > In dns.c I added > > #ifdef __APPLE__ > Ns_Cs cs; > Ns_CsEnter(&cs); > ... > Ns_CsLeave(&cs); > #endif > > to cope with this *at least* within our own program. This does not > guarantee that this is MT-safe because any of the rest of the > system may call those calls anytime, hence we get problems anyways. Why can't we fall back to using gethostbyname() on Darwin with it's mt-unsafe getaddrinfo()? gethostbyname() is also mt-unsafe, but we already have a critical section around that. If we have critical sections around two separate dns calls which return the same results, there's really no advantage in choosing one over the other, right? |
From: Zoran V. <zv...@ar...> - 2005-10-17 07:57:03
|
Am 17.10.2005 um 03:36 schrieb Stephen Deasey: > Why can't we fall back to using gethostbyname() on Darwin with it's > mt-unsafe getaddrinfo()? gethostbyname() is also mt-unsafe, but we > already have a critical section around that. If we have critical > sections around two separate dns calls which return the same results, > there's really no advantage in choosing one over the other, right? > > Hm... there IS a hidden one! Tcl core still uses MT-unsafe gethostbyname. If we'd to use the gethostbyname as well, no matter how protected we have made it within our process, the chances are we'd end up trampling on each other feet. On the short term I prefer this one. On the mid term I will replace the gethostbyname calls in Tcl core with something like dns.c in NS today. Cheers Zoran |
From: Stephen D. <sd...@gm...> - 2005-10-17 11:13:37
|
On 10/17/05, Zoran Vasiljevic <zv...@ar...> wrote: > > Am 17.10.2005 um 03:36 schrieb Stephen Deasey: > > > Why can't we fall back to using gethostbyname() on Darwin with it's > > mt-unsafe getaddrinfo()? gethostbyname() is also mt-unsafe, but we > > already have a critical section around that. If we have critical > > sections around two separate dns calls which return the same results, > > there's really no advantage in choosing one over the other, right? > > > > > > Hm... there IS a hidden one! > > Tcl core still uses MT-unsafe gethostbyname. If we'd to use the > gethostbyname as well, no matter how protected we have made it > within our process, the chances are we'd end up trampling on > each other feet. > > On the short term I prefer this one. On the mid term I will replace > the gethostbyname calls in Tcl core with something like dns.c in > NS today. Groovy. |