Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 03 May 1999 19:27:05 -0700
From:      David Greenman <dg@root.com>
To:        Bryce Newall <data@dreamhaven.net>
Cc:        Doug White <dwhite@resnet.uoregon.edu>, FreeBSD Questions List <freebsd-questions@FreeBSD.ORG>
Subject:   Re: No buffer space 
Message-ID:  <199905040227.TAA05263@implode.root.com>
In-Reply-To: Your message of "Mon, 03 May 1999 19:43:29 MDT." <Pine.NEB.4.10.9905031943010.53667-100000@calico.dreamhaven.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
>On Mon, 3 May 1999, Doug White wrote:
>
>> What does 'netsat -m' report?
>
>Right now, it's reporting:
>
>[51]data@calico:/home/data % netstat -m
>3929/4544 mbufs in use:
>        1528 mbufs allocated to data
>        2401 mbufs allocated to packet headers
>1389/1696/6000 mbuf clusters in use (current/peak/max)
>3960 Kbytes allocated to network (82% in use)
>0 requests for memory denied
>0 requests for memory delayed

   What does "sysctl vm.zone" report for "socket"? If USED+FREE is at or near
the LIMIT, then you're seeing the effects of a socket leak that I found
yesterday. The attached patches back out the changes that caused the leak.

-DG

David Greenman
Co-founder/Principal Architect, The FreeBSD Project - http://www.freebsd.org
Creator of high-performance Internet servers - http://www.terasolutions.com

Index: uipc_socket.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/uipc_socket.c,v
retrieving revision 1.51.2.1
diff -c -r1.51.2.1 uipc_socket.c
*** uipc_socket.c	1999/02/26 17:32:49	1.51.2.1
--- uipc_socket.c	1999/05/02 22:41:40
***************
*** 193,210 ****
  			TAILQ_REMOVE(&head->so_incomp, so, so_list);
  			head->so_incqlen--;
  		} else if (so->so_state & SS_COMP) {
! 			/*
! 			 * We must not decommission a socket that's
! 			 * on the accept(2) queue.  If we do, then
! 			 * accept(2) may hang after select(2) indicated
! 			 * that the listening socket was ready.
! 			 */
! 			return;
  		} else {
  			panic("sofree: not queued");
  		}
  		head->so_qlen--;
! 		so->so_state &= ~SS_INCOMP;
  		so->so_head = NULL;
  	}
  	sbrelease(&so->so_snd);
--- 193,204 ----
  			TAILQ_REMOVE(&head->so_incomp, so, so_list);
  			head->so_incqlen--;
  		} else if (so->so_state & SS_COMP) {
! 			TAILQ_REMOVE(&head->so_comp, so, so_list);
  		} else {
  			panic("sofree: not queued");
  		}
  		head->so_qlen--;
! 		so->so_state &= ~(SS_INCOMP|SS_COMP);
  		so->so_head = NULL;
  	}
  	sbrelease(&so->so_snd);
***************
*** 234,244 ****
  		}
  		for (sp = so->so_comp.tqh_first; sp != NULL; sp = sonext) {
  			sonext = sp->so_list.tqe_next;
- 			/* Dequeue from so_comp since sofree() won't do it */
- 			TAILQ_REMOVE(&so->so_comp, sp, so_list);
- 			so->so_qlen--;
- 			sp->so_state &= ~SS_COMP;
- 			sp->so_head = NULL;
  			(void) soabort(sp);
  		}
  	}
--- 228,233 ----
***************
*** 299,311 ****
  	if ((so->so_state & SS_NOFDREF) == 0)
  		panic("soaccept: !NOFDREF");
  	so->so_state &= ~SS_NOFDREF;
!  	if ((so->so_state & SS_ISDISCONNECTED) == 0)
! 		error = (*so->so_proto->pr_usrreqs->pru_accept)(so, nam);
! 	else {
! 		if (nam)
! 			*nam = 0;
! 		error = 0;
! 	}
  	splx(s);
  	return (error);
  }
--- 288,294 ----
  	if ((so->so_state & SS_NOFDREF) == 0)
  		panic("soaccept: !NOFDREF");
  	so->so_state &= ~SS_NOFDREF;
! 	error = (*so->so_proto->pr_usrreqs->pru_accept)(so, nam);
  	splx(s);
  	return (error);
  }


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




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