[jcifs] Re: Write files to shared location

Michael B Allen ioplex at gmail.com
Tue Dec 9 18:57:49 GMT 2008


I think your diagnosis is incorrect. The exception you're seeing has
nothing to do with getDiskFreeSpace.

Get a capture and send it to me directly.

Mike

On Tue, Dec 9, 2008 at 2:45 AM, Duseja, Sushil <sushil.duseja at fiserv.com> wrote:
> Hello Mike,
>
>
>
> Thanks again; I really appreciate the help extended by you.
>
>
>
> I tried using just a single thread (and separate SmbFile objects) to perform
> my operation but to no avail. I still ran into the same issue. Please refer
> to the attached file.
>
>
>
> Additionally, having looked at the stack trace (attached for your kind
> reference) and browsing through the source code; I learnt that exception -
> "The parameter is incorrect" is mapped to
> NtStatus.NT_STATUS_INVALID_INFO_CLASS, which is part of class - SmbFile.java
> and method – getDiskFreeSpace() as shown below.
>
> Please correct me if I am wrong.
>
>
>
> public long getDiskFreeSpace() throws SmbException {
>
>         if( getType() == TYPE_SHARE || type == TYPE_FILESYSTEM ) {
>
>             int level =
> Trans2QueryFSInformationResponse.SMB_FS_FULL_SIZE_INFORMATION;
>
>             try {
>
>                 return queryFSInformation(level);
>
>             } catch( SmbException ex ) {
>
>                 switch (ex.getNtStatus()) {
>
>                     case NtStatus.NT_STATUS_INVALID_INFO_CLASS:
>
>                     case NtStatus.NT_STATUS_UNSUCCESSFUL: // NetApp Filer
>
>                         // SMB_FS_FULL_SIZE_INFORMATION not supported by the
> server.
>
>                         level =
> Trans2QueryFSInformationResponse.SMB_INFO_ALLOCATION;
>
>                         return queryFSInformation(level);
>
>                 }
>
>                 throw ex;
>
>             }
>
>         }
>
>         return 0L;
>
>     }
>
>
>
> By any chance, can disk free space be the root cause? I double-checked the
> free disk space and found it be approx. 180 GB, and the files would not take
> more than 100 MB.
>
>
>
> Kindly share your thoughts.
>
>
>
> Thanks!
>
>
>
>
>
> -----Original Message-----
> From: Michael B Allen [mailto:ioplex at gmail.com]
> Sent: Tuesday, December 09, 2008 12:48 AM
> To: Duseja, Sushil
> Cc: Rally, Menka; jcifs at lists.samba.org
> Subject: Re: Write files to shared location
>
>
>
> On Mon, Dec 8, 2008 at 10:15 AM, Duseja, Sushil
>
> <sushil.duseja at fiserv.com> wrote:
>
>> Hello Mike,
>
>>
>
>> Thanks for the response.
>
>>
>
>> You are right; I am using multiple threads with one SmbFile instance but
>
>> that is precisely my requirement. I need to use multiple threads for the
>
>> processing (that includes creating files).
>
>
>
> The SmbFile class is not thread-safe. Specifically you cannot create
>
> one single instance of an SmbFile object and have multiple threads
>
> operate on it simultaneously.
>
>
>
>> Can you please suggest a workaround?
>
>
>
> The solution is very simple - just create separate SmbFile objects as
>
> necessary to perform the desired operation. Meaning, each thread must
>
> have it's own SmbFile instance to work on. That is thread-safe.
>
> However, obviously it is not ok to have more than one thread work on
>
> the same exact *file*.
>
>
>
>> Or else, can you please let me know
>
>> if I can use java.io.File instance for my purpose (creating files at
>
>> password protected network location)?
>
>
>
> All of the above mentioned behavior is also true of java.io.File so
>
> I'm not sure if using that would help you.
>
>
>
> Mike
>
>
>
>> -----Original Message-----
>
>> From: Michael B Allen [mailto:ioplex at gmail.com]
>
>> Sent: Monday, December 08, 2008 12:50 AM
>
>> To: Duseja, Sushil
>
>> Cc: jcifs at lists.samba.org
>
>> Subject: Re: Write files to shared location
>
>>
>
>> On Sun, Dec 7, 2008 at 1:45 PM, Duseja, Sushil
>
>> <sushil.duseja at fiserv.com> wrote:
>
>>> Hello,
>
>>>
>
>>> I am required to write/save (large number of) files (approx. 10000) to
>
>> a
>
>>> (secured) shared drive location (using jCIFS 1.3.1). If a file with
>
>> the same
>
>>> name already exists, a new file needs to be created with an index
>
>> higher
>
>>> than the previous one.
>
>>>
>
>>> I am using the constuctor -
>
>>> SmbFile("smb://domain;username:password@server/..../") or this purpose
>
>> and I
>
>>> can connect to the shared location successfully; however during the
>
>> creation
>
>>> of files, after generating few files, an Smbexception is thrown.
>
>>>
>
>>> Here's the stacktrace:-
>
>>>
>
>>> jcifs.smb.SmbException: The parameter is incorrect.
>
>>>         at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:542)
>
>>>         at jcifs.smb.SmbTransport.send(SmbTransport.java:644)
>
>>>         at jcifs.smb.SmbSession.sessionSetup(SmbSession.java:356)
>
>>>         at jcifs.smb.SmbSession.send(SmbSession.java:234)
>
>>>         at jcifs.smb.SmbTree.treeConnect(SmbTree.java:161)
>
>>>         at jcifs.smb.SmbTree.send(SmbTree.java:66)
>
>>>         at jcifs.smb.SmbFile.send(SmbFile.java:729)
>
>>>         at jcifs.smb.SmbFile.queryPath(SmbFile.java:1308)
>
>>>         at jcifs.smb.SmbFile.exists(SmbFile.java:1362)
>
>>
>
>> Unless you're doing something bad like using multiple threads with the
>
>> same SmbFile instance, the "parameter is incorrect" error should never
>
>> occur and thus this would be a bug.
>
>>
>
>> The fastest way to find out what's going on is to get a packet
>
>> capture. If you do get a packet capture of the error, make sure you
>
>> send it to me directly. Do not post packet captures to public mailing
>
>> lists.
>
>>
>
>> Mike
>
>>
>
>> PS: It's considered very bad form to use credentials in the URL. Use
>
>> (and re-use) an NtlmPasswordAuthentication object.
>
>>
>
>> --
>
>> Michael B Allen
>
>> PHP Active Directory SPNEGO SSO
>
>> http://www.ioplex.com/
>
>>
>
>
>
>
>
>
>
> --
>
> Michael B Allen
>
> PHP Active Directory SPNEGO SSO
>
> http://www.ioplex.com/



-- 
Michael B Allen
PHP Active Directory SPNEGO SSO
http://www.ioplex.com/


More information about the jcifs mailing list