[jcifs] Threads locked while calling SmbFile.getSecurity
Marc Brette
marc.brette at gmail.com
Tue Aug 5 09:45:55 GMT 2008
I resend this email as it didn't appear in the list:
Hi Mike,
On another machine, I actually hit the issue with only 14 threads.
[update: and even 10 threads]
It seems this is machine dependent.
Do you think about a work-around so that I could avoid this limit ?
Note: I didn't try the new versions you shipped since, but it didn't
seem to solve the issue.
On 7/29/08, Marc Brette <marc.brette at gmail.com> wrote:
> Hi Mike,
> On another machine, I actually hit the issue with only 14 threads.
> It seems this is machine dependent.
> Do you think about a work-around so that I could avoid this limit ?
>
> Note: I didn't try the new versions you shipped since, but it didn't seem to
> solve the issue.
>
> --Marc
>
> On Wed, Jun 4, 2008 at 6:58 PM, Michael B Allen <ioplex at gmail.com> wrote:
>
>> I think you're hitting jcifs.smb.maxBuffers which defaults to 16.
>>
>> But I have to wonder how you're getting into that scenario and if
>> increasing that value is the right thing to do.
>>
>> Mike
>>
>> On 6/4/08, Marc Brette <marc.brette at gmail.com> wrote:
>> > I have an issue where 16 threads calling SmbFile.getSecurity are
>> > blocked.
>> > When I have only 15 threads, it works fine (note that each thread
>> accesses a
>> > different document, but on the same server).
>> > I use JCIFS 1.2.21. And tested on different shared drives (with and
>> without
>> > credentials). I initially tested with 1.2.18 with a more complex example
>> so
>> > I guess it s not specific to the JCIFS version.
>> > Is it something known ? I saw some thread talking about deadlock in
>> jcifs
>> > but it seemed to be in situation unlikely to occur in reality.
>> >
>> > Here is my code:
>> > import java.util.List;
>> > import java.util.Arrays;
>> >
>> > import jcifs.smb.SmbFile;
>> > import jcifs.smb.NtlmPasswordAuthentication;
>> >
>> > public class TestDeadlock
>> > {
>> > static
>> > {
>> > System.setProperty("java.protocol.handler.pkgs",
>> > "jcifs");
>> > }
>> >
>> > public static void main(String[] args) throws InterruptedException
>> > {
>> > final List<String> dataset = Arrays.asList(
>> >
>> > "smb://frgr1dev1/Y_Drive/Documentation/javadocs/ant/ant
>> > 1.6.2 api/org/apache/tools/zip/package-frame.html"
>> > ,
>> > "smb://frgr1dev1/Y_Drive/Documentation/javadocs/ant/ant
>> > 1.6.2
>> >
>> api/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.html"
>> > ,
>> > "smb://frgr1dev1/Y_Drive/Documentation/javadocs/ant/ant
>> > 1.6.2 api/org/apache/tools/ant/types/Reference.html"
>> > ,
>> >
>> "smb://frgr1dev1/Y_Drive/Documentation/javadocs/jdk/jdk1.3.1/javax/rmi/package-use.html"
>> > ,
>> >
>> "smb://frgr1dev1/Y_Drive/Documentation/javadocs/jdk/jdk1.3.1/java/io/FilterOutputStream.html"
>> > ,
>> >
>> "smb://frgr1dev1/Y_Drive/Documentation/javadocs/jdk/jdk1.3.1/javax/accessibility/AccessibleTableModelChange.html"
>> > ,
>> >
>> "smb://frgr1dev1/Y_Drive/Documentation/javadocs/jdk/jdk1.4.2/org/omg/stub/java/"
>> > ,
>> >
>> "smb://frgr1dev1/Y_Drive/Documentation/javadocs/jdk/jdk1.3.1/javax/transaction/InvalidTransactionException.html"
>> > ,
>> > "smb://frgr1dev1/Y_Drive/Documentation/javadocs/ant/ant
>> > 1.6.2
>> >
>> api/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.NodeListImpl.html"
>> > ,
>> >
>> "smb://frgr1dev1/Y_Drive/Documentation/javadocs/jdk/jdk1.4.2/java/awt/geom/AffineTransform.html"
>> > ,
>> >
>> "smb://frgr1dev1/Y_Drive/Documentation/javadocs/jdk/jdk1.3.1/javax/naming/ldap/package-frame.html"
>> > ,
>> >
>> "smb://frgr1dev1/Y_Drive/Documentation/javadocs/jdk/jdk1.3.1/java/awt/Shape.html"
>> > ,
>> >
>> "smb://frgr1dev1/Y_Drive/Documentation/javadocs/jdk/jdk1.4.2/javax/transaction/xa/package-summary.html"
>> > ,
>> > "smb://frgr1dev1/Y_Drive/Documentation/javadocs/ant/ant
>> > 1.6.2
>> > api/org/apache/tools/ant/taskdefs/optional/script/package-summary.html"
>> > ,
>> >
>> "smb://frgr1dev1/Y_Drive/Documentation/javadocs/jdk/jdk1.4.2/javax/net/ServerSocketFactory.html");
>> >
>> > int start = 0;
>> > int end = 15;
>> > Thread[] workers = new Thread[end - start];
>> > for (int i = start; i < end; i++)
>> > {
>> > final String url = dataset.get(i);
>> > workers[i - start] = new Thread(new Runnable()
>> > {
>> > public void run()
>> > {
>> > try
>> > {
>> > SmbFile f = new SmbFile(url);
>> > System.out.println(url + " security = " +
>> > f.getSecurity(true)); //This trace never shows up
>> >
>> > } catch (Throwable e)
>> > {
>> > e.printStackTrace();
>> > }
>> > }
>> > });
>> > }
>> >
>> > for (Thread worker : workers)
>> > {
>> > worker.start();
>> > }
>> >
>> > for (Thread worker : workers)
>> > {
>> > worker.join();
>> > }
>> > }
>> > }
>> >
>> > Here is an extract of the threads stacktrace dump:
>> >
>> > "Thread-4" prio=6 tid=0x0033dde8 nid=0x64d4 in Object.wait()
>> > [0x031bf000..0x031bf9e8]
>> > at java.lang.Object.wait(Native Method)
>> > - waiting on <0x2465e260> (a [Ljava.lang.Object;)
>> > at java.lang.Object.wait(Object.java:474)
>> > at
>> > jcifs.smb.BufferCache.getBuffers(BufferCache.java:55)
>> > - locked <0x2465e260> (a [Ljava.lang.Object;)
>> > at jcifs.smb.SmbTransport.send(SmbTransport.java:547)
>> > at jcifs.smb.SmbSession.send(SmbSession.java:239)
>> > - locked <0x2467f780> (a java.lang.Object)
>> > at jcifs.smb.SmbTree.send(SmbTree.java:109)
>> > at jcifs.smb.SmbFile.send(SmbFile.java:695)
>> > at
>> >
>> jcifs.smb.TransactNamedPipeOutputStream.write(TransactNamedPipeOutputStream.java:65)
>> > at
>> > jcifs.dcerpc.DcerpcPipeHandle.doSendFragment(DcerpcPipeHandle.java:59)
>> > at
>> > jcifs.dcerpc.DcerpcHandle.sendrecv(DcerpcHandle.java:164)
>> > at
>> > jcifs.dcerpc.msrpc.LsaPolicyHandle.<init>(LsaPolicyHandle.java:34)
>> > at jcifs.smb.SID.resolveSids0(SID.java:136)
>> > at jcifs.smb.SID.resolveSids(SID.java:179)
>> > at jcifs.smb.SmbFile.processAces(SmbFile.java:2774)
>> > at jcifs.smb.SmbFile.getSecurity(SmbFile.java:2808)
>> > at TestDeadlock$1.run(TestDeadlock.java:84)
>> > at java.lang.Thread.run(Thread.java:595)
>> >
>> > "Thread-3" prio=6 tid=0x0033dc60 nid=0x4494 waiting for monitor entry
>> > [0x0317f000..0x0317fce8]
>> > at jcifs.smb.SmbTree.treeConnect(SmbTree.java:128)
>> > - waiting to lock <0x2467f780> (a java.lang.Object)
>> > at jcifs.smb.SmbTree.send(SmbTree.java:64)
>> > at jcifs.smb.SmbFile.send(SmbFile.java:695)
>> > at
>> >
>> jcifs.smb.TransactNamedPipeOutputStream.write(TransactNamedPipeOutputStream.java:65)
>> > at
>> > jcifs.dcerpc.DcerpcPipeHandle.doSendFragment(DcerpcPipeHandle.java:59)
>> > at
>> > jcifs.dcerpc.DcerpcHandle.sendrecv(DcerpcHandle.java:164)
>> > at
>> > jcifs.dcerpc.msrpc.LsaPolicyHandle.<init>(LsaPolicyHandle.java:34)
>> > at jcifs.smb.SID.resolveSids0(SID.java:136)
>> > at jcifs.smb.SID.resolveSids(SID.java:179)
>> > at jcifs.smb.SmbFile.processAces(SmbFile.java:2774)
>> > at jcifs.smb.SmbFile.getSecurity(SmbFile.java:2808)
>> > at TestDeadlock$1.run(TestDeadlock.java:84)
>> > at java.lang.Thread.run(Thread.java:595)
>> >
>> > ... other threads stack traces are similar to "Thread-3" above.
>> >
>> > Regards
>> > -- Marc
>> >
>> >
>> >
>> >
>>
>>
>> --
>> Michael B Allen
>> PHP Active Directory SPNEGO SSO
>> http://www.ioplex.com/
>>
>
More information about the jcifs
mailing list