Bug 17895

Summary: stale unix domain connections
Product: Base System Reporter: ian
Component: kernAssignee: dwmalone
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   

Description ian 2000-04-10 10:40:02 UTC
Poorly written (alpha) code which opens a unix domain listener socket,
but which fail's to 'attach' in combination with a client attached to
this, can leave open connections which do not appear to time out when
the socket is closed due to a terminate.

I would guess that if enough of these were left laying around it could
eventually chew up enough resouces to cause problems.

netstat -an output follows

cde970c0 stream    0   0   0   0   0   0 /home/ian/tools/testsocket
cde97140 stream    0   0   0   0   0   0 /home/ian/tools/testsocket
cde97d80 stream    0   0   0   0   0   0 /home/ian/tools/testsocket
cde97f00 stream    0   0   0   0   0   0 /home/ian/tools/testsocket
cde97180 stream    0   0   0   0   0   0 /home/ian/tools/testsocket
cde974c0 stream   12   0   0   0   0   0 /home/ian/tools/testsocket
cde97640 stream    0   0   0   0   0   0 /home/ian/tools/testsocket
cde978c0 stream    1   0   0   0   0   0 /home/ian/tools/testsocket

Fix: 

Unknown at this stage. I suspect a check needs to be made on
exit for open unix domain sockets ? Where are ipv4 domain sockets
checked ? do they just wait for a timeout ?
How-To-Repeat: Open a unix domain socket for listen. Connect to it from a another
program, terminate the listener before the connection has been
'accepted' The connection seems to remain.
Comment 1 Mike Barcroft freebsd_committer freebsd_triage 2001-07-22 02:24:56 UTC
State Changed
From-To: open->feedback


Does this problem still occur in newer versions of FreeBSD, 
such as 4.3-RELEASE?
Comment 2 dwmalone freebsd_committer freebsd_triage 2001-07-22 11:51:27 UTC
Responsible Changed
From-To: freebsd-bugs->dwmalone

I've checked and it looks like this problem continues to exist in -current. 
I've been looking at unix domain stuff, so I'll take the PR.
Comment 3 iedowse freebsd_committer freebsd_triage 2002-02-28 13:41:18 UTC
State Changed
From-To: feedback->closed


Fixed in both -CURRENT and -STABLE (kern/uipc_usrreq.c rev 1.81). 
We had seen this locally ages ago with xdm when X was having trouble 
starting, but it was just when it happened to us again recently 
that I was reminded to investigate it. Looks like the bug was there 
since Feb 1999.