[jcifs] CLOSE_WAIT-Connections left

Michael B Allen mba2000 at ioplex.com
Fri Jun 16 17:12:05 GMT 2006

On Fri, 16 Jun 2006 14:50:52 +0200
Martin <martin at heddergott.org> wrote:

> Hello,
> we have a small set of unix-scripts (mysql + smbclient) which crawls our
> local network-shares for Documents and adds them into a database where
> it can be searched by our users.
> Now i found jcifs and gave it a try because the scripts are really slow
> sometimes and i just prefer a JAVA-solution :)
> Jcifs works pretty good (!!), but after searching for a while, there are
> much connections in "close_wait" left. This is a problem i think,
> because it can cause the operating-system to not open new connections
> right ?

No, CLOSE_WAIT status is part of the normal life cycle for a TCP
connection. It has something to do with waiting for an acknowledgement
that MAY never come and therefore the OS kernel must leave the socket
state open for a while. It's not entirely clear to me why it should even
bother but that's just the way it works.

The reason your seeing so many is because you're just creating so many
sockets in a brief period.

> I did not found any method to force jcifs to close the connection
> completely. Are there any methods to close a connection manually or
> after a certain couple of seconds? Calling the close-Method with
> reflection did not work.

No. JCIFS transport close after jcifs.smb.client.soTimeout milliseconds
of inactivity.

You definitely want to reduce soTimeout and possibly some other properties
like the attribute expiration. Search the list. I've posted about this
a long time ago. Tweeking properties is REALLY important for crawling.


Michael B Allen
PHP Extension for SSO w/ Windows Group Authorization

More information about the jcifs mailing list