[jcifs] Strange issue with SmbFileInputStream
René Liebmann
rene_liebmann at datamatics.de
Thu Jan 28 06:52:47 MST 2010
Hi Mike,
Thank you for your response. Usually I have wrapped my Java app with an EXE.
I have changed this now and the behavior is a bit different, but the result
seems to be the same. The reason is an OutOfMemoryError, which in fact
should not be, as I use the options -Xms400m -Xmx400m and during the time
when it hangs my app has just 100 M occupied as per TaskManager. I also
increased the memory to 800m. Then 2 or 3 files more are getting copied and
it hangs again. Please find here the dump, which came up in the console:
C:\tmp>java -Xms400m -Xmx400m com.rli.fsi.gui.FileSystemInventory
Exception in thread "pool-1-thread-2" java.lang.OutOfMemoryError: unable to
crea
te new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Unknown Source)
at jcifs.UniAddress.lookupServerOrWorkgroup(UniAddress.java:172)
at jcifs.UniAddress.getAllByName(UniAddress.java:290)
at jcifs.UniAddress.getByName(UniAddress.java:245)
at jcifs.smb.Dfs.getTrustedDomains(Dfs.java:62)
at jcifs.smb.Dfs.resolve(Dfs.java:167)
at jcifs.smb.SmbFile.resolveDfs(SmbFile.java:666)
at jcifs.smb.SmbFile.send(SmbFile.java:768)
at jcifs.smb.SmbFile.close(SmbFile.java:1009)
at jcifs.smb.SmbFile.close(SmbFile.java:1015)
at jcifs.smb.SmbFile.close(SmbFile.java:1019)
at jcifs.smb.SmbFileInputStream.close(SmbFileInputStream.java:104)
at
com.rli.fsi.SmbFileAnalyserThread.copySmbFileTo(SmbFileAnalyserThread
.java:312)
at
com.rli.fsi.SmbFileAnalyserThread.run(SmbFileAnalyserThread.java:103)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)
at java.lang.Thread.run(Unknown Source)
Thanks
René
-----Ursprüngliche Nachricht-----
Von: Michael B Allen [mailto:ioplex at gmail.com]
Gesendet: Mittwoch, 27. Januar 2010 18:05
An: Rene Liebmann
Cc: jcifs at lists.samba.org
Betreff: Re: [jcifs] Strange issue with SmbFileInputStream
Hi Rene,
Wait a while to make sure it is really hanging. If it does not respond
after a few minutes, get a thread-dump using Ctrl-Break on Windows or
Ctrl-\ on Unix in a console. That will show you exactly where it's
stuck.
Mike
On Wed, Jan 27, 2010 at 11:35 AM, René Liebmann
<rene_liebmann at datamatics.de> wrote:
> Hi all,
>
>
>
> I have a small function which I use to copy a remote file to my local
> machine. On almost all environments (Win XP Home) this works fine, but on
a
> Windows 2003 Server environment it does only copy a small portion of a
file
> e.g. if the file is 6 MB large it copies 248 kB. Then it seems that it
never
> leaves the while block and my program hangs. It does not throw any
> exception. What am I doing wrong?
>
>
>
> private void copySmbFileTo(SmbFile f, String location) throws IOException
{
>
> logger.debug(name + " enter function copySmbFileTo
"+f.getUncPath()
> + " to "+location);
>
>
>
> SmbFileInputStream istr = null;
>
> OutputStream ostr = null;
>
> try { // 1
>
> istr = new SmbFileInputStream(f);
>
> ostr = new FileOutputStream(location);
>
> byte[] buf1 = new byte[1024];
>
> int len1;
>
> while((len1 = istr.read(buf1)) > 0){
>
> ostr.write(buf1, 0, len1);
>
> }
>
> ostr.flush();
>
> } catch(Exception ex){
>
> logger.error("", ex);
>
> } finally{
>
> try { // 2
>
> if(istr!=null) istr.close();
>
> if(ostr!=null) ostr.close();
>
> } catch(Exception ex){
>
> logger.error("Major Error Releasing Streams:", ex);
>
>
>
> } // End try catch number 2
>
> } // End try catch finally number 1
>
> logger.debug(name + " leave function copySmbFileTo");
>
>
>
> }
>
>
>
> Thanks for your ideas in advance
>
>
>
> René
>
>
--
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/
More information about the jCIFS
mailing list