<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>I’ve been chasing a couple of issues for several days now and finally tracked both of them down to a couple of lines in the exception handler for SmbSession.send():</div><div><br></div><div><div>            if (request instanceof SmbComTreeConnectAndX) {</div><div>                logoff(true);</div><div>            }</div></div><div><br></div><div>in my case, the SmbComTreeConnectAndX is failing because the share doesn’t exist, in which case the logoff() seems extreme. The logoff does a tree disconnect on all the trees associated with the session, which in turn closes any open files, including named pipes. The initial issue I was trying to track down was named pipe that was being used in another thread that was randomly getting closed prematurely.</div><div><br></div><div>The second issue I was trying to track down was sudden spikes in the number of sessions open on the server. I was finally able to duplicate the spikes with a little loop like this:</div><div><br></div><div><div>        SmbFile badShare = null;</div><div>        try {</div><div>            badShare = new SmbFile("<a href="smb://MYSERVER/BOGUS">smb://MYSERVER/BOGUS</a>", new NtlmPasswordAuthentication(“MYDOMAIN", "Administrator", “mypassword"));</div><div>            for (int i = 0; i < 1000; i++) {</div><div>                try {</div><div>                    System.err.println(i);</div><div>                    badShare.exists();</div><div>                } catch (SmbException e) {</div><div>                }</div><div>            }</div><div>        } catch (MalformedURLException e) {</div><div>        }</div></div><div><br></div><div>Which will very quickly cause 1000 sessions to be opened on the server and will cause many other operations to fail with SMB Error 0xC0000205 (STATUS_INSUFF_SERVER_RESOURCES)</div><div><br></div><div>I’m not sure why doing the logout on failure of SmbComTreeConnectAndX leaks connections, but by commenting it out, the session count remains steady at 1 from the client machine.</div><div><br></div><div>So the big question is why/when would a logoff() be the right thing to do? What is going to break of I remove it completely? Are there specific error codes that would be a good indication that the logoff() is really necessary?</div><div><br></div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: 19px; font-weight: bold; display: inline !important; float: none; ">Shon Vella</span><br style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-size: 19px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span style="color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: 10pt; ">Developer<br>iDENTiTY<span style="color: rgb(204, 0, 0); ">AUTOMATiON</span><br></span></span></div></body></html>