<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <font size="-1"><font face="Lucida Sans Unicode">We find this all
        the time and as far as we can tell this is always related to an
        incorrect DFS configuration in the domain controller (or the DNS
        server).<br>
        If you are not using DFS, disable it in jcifs.<br>
        <br>
      </font></font>
    <div class="moz-cite-prefix">On 07/08/2014 04:29, Stefan Neis wrote:<br>
    </div>
    <blockquote
cite="mid:9F98B5C5A98AD24AB7A09DF4E60758205C3F89@ntserver.auteq-software.local"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="Microsoft Word 11 (filtered
        medium)">
      <style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
pre
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.E-MailFormatvorlage17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
      <div class="Section1">
        <p class="MsoNormal"><font face="Times New Roman" size="3"><span
              style="font-size:12.0pt" lang="EN-US">Hi JCIFS support
              team,<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Arial" size="2"><span
              style="font-size:
              10.0pt;font-family:Arial" lang="EN-US"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Times New Roman" size="3"><span
              style="font-size:12.0pt" lang="EN-US">while we are
              investigating thread behavior on our
              application server we stumbled over dozens of Transport
              threads in blocking
              state. It turned out that they are belonging to the jCIFS
              framework on
              connecting to a not existing SMB resource. To reproduce
              this I wrote a little piece
              of code:<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Times New Roman" size="3"><span
              style="font-size:12.0pt" lang="EN-US"><o:p> </o:p></span></font></p>
        <p class="MsoNormal" style="text-autospace:none"><font
            color="black" face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:Consolas;color:black">       
            </span></font><b><font color="#7f0055" face="Consolas"
              size="2"><span
style="font-size:10.0pt;font-family:Consolas;color:#7F0055;font-weight:bold">for</span></font></b><font
            color="black" face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:
              Consolas;color:black"> (</span></font><b><font
              color="#7f0055" face="Consolas" size="2"><span
                style="font-size:10.0pt;font-family:Consolas;color:#7F0055;
                font-weight:bold">int</span></font></b><font
            color="black" face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:Consolas;color:black">
              i = 0; i < 100;
              i++) {</span></font><font face="Consolas" size="2"><span
              style="font-size:10.0pt;
              font-family:Consolas"><o:p></o:p></span></font></p>
        <p class="MsoNormal" style="text-autospace:none"><font
            color="black" face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:Consolas;color:black">           
            </span></font><b><font color="#7f0055" face="Consolas"
              size="2"><span
style="font-size:10.0pt;font-family:Consolas;color:#7F0055;font-weight:bold">try</span></font></b><font
            color="black" face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:
              Consolas;color:black"> {</span></font><font
            face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:Consolas"><o:p></o:p></span></font></p>
        <p class="MsoNormal" style="text-autospace:none"><font
            color="black" face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:Consolas;color:black">               
SmbFile
              folder = </span></font><b><font color="#7f0055"
              face="Consolas" size="2"><span
style="font-size:10.0pt;font-family:Consolas;color:#7F0055;font-weight:bold">new</span></font></b><font
            color="black" face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:
              Consolas;color:black"> SmbFile("</span></font><font
            color="#2a00ff" face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:Consolas;color:#2A00FF">smb://192.168.100.77/test"</span></font><font
            color="black" face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:
              Consolas;color:black">);</span></font><font
            face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:Consolas"><o:p></o:p></span></font></p>
        <p class="MsoNormal" style="text-autospace:none"><font
            color="black" face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:Consolas;color:black">               
              folder.exists();</span></font><font face="Consolas"
            size="2"><span style="font-size:10.0pt;font-family:Consolas"><o:p></o:p></span></font></p>
        <p class="MsoNormal" style="text-autospace:none"><font
            color="black" face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:Consolas;color:black">           
              }</span></font><font face="Consolas" size="2"><span
              style="font-size:10.0pt;
              font-family:Consolas"><o:p></o:p></span></font></p>
        <p class="MsoNormal" style="text-autospace:none"><font
            color="black" face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:Consolas;color:black">           
            </span></font><b><font color="#7f0055" face="Consolas"
              size="2"><span
style="font-size:10.0pt;font-family:Consolas;color:#7F0055;font-weight:bold">catch</span></font></b><font
            color="black" face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:
              Consolas;color:black"> (SmbException e) {<o:p></o:p></span></font></p>
        <p class="MsoNormal" style="text-autospace:none"><font
            face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:Consolas"><o:p> </o:p></span></font></p>
        <p class="MsoNormal" style="text-autospace:none"><font
            color="black" face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:Consolas;color:black">           
              }</span></font><font face="Consolas" size="2"><span
              style="font-size:10.0pt;
              font-family:Consolas"><o:p></o:p></span></font></p>
        <p class="MsoNormal"><font color="black" face="Consolas"
            size="2"><span
              style="font-size:10.0pt;font-family:Consolas;color:black">       
              }<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font color="black" face="Consolas"
            size="2"><span
              style="font-size:10.0pt;font-family:Consolas;color:black"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Times New Roman" size="3"><span
              style="font-size:12.0pt" lang="EN-US">My observations with
              the tool VisualVM are as follows.
              On the call exists() a thread named Transport1 is created.
              After 30 seconds a SmbException
              occurs:<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Times New Roman" size="3"><span
              style="font-size:12.0pt" lang="EN-US"><o:p> </o:p></span></font></p>
        <p class="MsoNormal" style="text-autospace:none"><font
            face="Consolas" size="2"><span
              style="font-size:10.0pt;font-family:Consolas">jcifs.smb.SmbException:
              Failed to
              connect: 0.0.0.0<00>/192.168.100.77<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Consolas" size="2"><span
              style="font-size:10.0pt;
              font-family:Consolas">jcifs.util.transport.TransportException:
              Connection
              timeout<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Consolas" size="2"><span
              style="font-size:10.0pt;
              font-family:Consolas"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Times New Roman" size="3"><span
              style="font-size:12.0pt" lang="EN-US">That is okay because
              the resource dos not exist. The
              next call to exists() creates another Transport1 thread,
              while the first one is
              still active for further 15 seconds. The second one is
              getting blocked by the
              first thread. Because of the fact that the interval
              threads are getting
              produced is shorter than the interval the threads are
              running, more and more
              threads are in blocking state.<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Times New Roman" size="3"><span
              style="font-size:12.0pt" lang="EN-US">I tested it with
              jCIFS version 1.3.15 and 1.3.17.<o:p></o:p></span></font></p>
        <p class="MsoNormal"><font face="Times New Roman" size="3"><span
              style="font-size:12.0pt" lang="EN-US"><o:p> </o:p></span></font></p>
        <p class="MsoNormal"><font face="Times New Roman" size="3"><span
              style="font-size:12.0pt" lang="EN-US">The quick and dirty
              solution is to wait al least 15
              seconds after every thrown exception, but in my opinion it
              can't be the callers
              <span class="st">responsibility to handle frameworks
                internal processes. And what
                if I want to access the same resource from different
                places in my code?<o:p></o:p></span></span></font></p>
        <p class="MsoNormal"><span class="st"><font face="Times New
              Roman" size="3"><span style="font-size:12.0pt"
                lang="EN-US"><o:p> </o:p></span></font></span></p>
        <p class="MsoNormal"><span class="st"><font face="Times New
              Roman" size="3"><span style="font-size:12.0pt"
                lang="EN-US">Do you agree with this or am I doing
                something completely wrong?</span></font></span><span
            lang="EN-US"><o:p></o:p></span></p>
      </div>
    </blockquote>
    <br>
  </body>
</html>