[jcifs] Invalid share causes all free connections consumption

Gergan Dimitrov gergan.dimitrov at gmail.com
Mon Feb 21 09:08:44 MST 2011


Hi All,

I have an windows share listener, which listens for new files on Windows
share on 1 second interval. I first try to connect to the server with
SmbSession.logon method and then call the SmbFile.exists() method for the
directory to listen, both with same user credentials. But if the share name
is invalid, after a short period I get run out of free connections to the
server. Since the server ip and credentials are correct, the logon method
succeeds. Then the exists() method throws exception. It seems that on each
next logon, more connections are created, while the old are not closed. Of
course, I could not use the logon method each time, but even if I call it
from other application for the same credentials, I get the same result. If I
skip the logon part, the problem does not appear, but as I said - it could
be called from other application. Please, tell if you have any idea why the
wrong share causes such behaviour.

The problem can be very easily simulated, but if you need any stack traces
or thread dumps, please say so. You can see the growing number of IPC$
connections from the  computer management/ system tools/ shared
folders/shares tool in Windows. I must add some things:

1) When the logon succeeds, the SmbTransport created for it is for port 0,
while the SmbFile is for port 445, and so at leas two connections are
firstly created. Port was not provided for the logon method, or the smb file
creation. I tried also with setting port 445 for the logon, but the result
was the same
2) I could not see more than two SmbTransport objects in the CONNECTIONS
collection.
3) when the connection from the SmbFile is successful, but the share cannot
be found, the flag treeConnected on the SmbTree objects remains to false.

Thank you in advance,
Gergan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/jcifs/attachments/20110221/74deae93/attachment.html>


More information about the jCIFS mailing list