lkml.org 
[lkml]   [1999]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: NONBLOCKing close blocks in named
On Sat, Sep 18, 1999 at 01:11:38AM +0100, Steven Clarke wrote:

> On Fri, 17 Sep 1999, Alan Cox wrote:
>
> > > If a socket file description has the O_NONBLOCK flag set, a close syscall
> > > should return almost straight away, right?
> >
> > If SO_LINGER is set the close() blocks. If SO_LINGER is not set it doesnt
> > block. Ok thats the theory anyway.
> >
> > Check the SO_LINGER settings
>
> Should have mentioned that I checked that. According to the strace,
> SO_LINGER hasn't been set or unset on that file descriptor (curiously, it
> had been set on a previous socket from the same IP and with the same file
> descriptor number).
>
> Even where the LINGER was set (elsewhere in the code) it was set to 120
> (units - seconds? - claims to be hundreths of seconds in the setsockopt
> man page but I think that's wrong). In the problem that I demonstrated,
> close took 11 minutes to return!
>
> I'm tempted to comment out the only SO_LINGER entry in BIND (it doesn't
> seem to be needed) to see it help - I'm not sure.

We had to do this on our nameservers to stop similar problems. Removing
SO_LINGER fixed it.

I created this (cheap) patch that seems to do the trick:

diff -ru src/bin/named/ns_main.c bind-8.2.1/bin/named/ns_main.c
--- src/bin/named/ns_main.c Thu Jun 17 19:26:54 1999
+++ bind-8.2.1/bin/named/ns_main.c Thu Jun 24 13:31:22 1999
@@ -1719,6 +1719,7 @@
*/
int
sq_openw(struct qstream *qs, int buflen) {
+#undef SO_LINGER
#ifdef SO_LINGER /* XXX */
static const struct linger ll = { 1, 120 };
#endif
Against 8.2.1 in this case. Should also apply to 8.1.2.

Simon-

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [from the cache]
©2003-2011 Jasper Spaans