Open qiuhuanhen opened 1 year ago
and I don't sure whether it would download fail in some env because of this exception
The SmbException is completely fine, that is just the end of file indication. The other one suggest a slight problem in shutdown order (internally in the library, not your code), and the socket being accessed after being closed, possbile race condition. But as that happens during shutdown, in your case likely JVM shutdown, I would not expect that to cause any practical issues.
thx for reply,I get it from your answer. But my case JVM shutdown just in main thread for testing, it might in springboot env or others(production env), vm might not shutdown in long time. I guess your mention “internally in the library ” means the native method in socket .I‘m afiraid "the socket being accessed after being closed" to makes oom . of course ,it's just my worried, may be my option is not right
I have seen #168 ,but I don't sure it's the same issue. In the end of Exception , Socket closed occured, and the level of logger is error
error log
11:41:08.843 [Transport0] DEBUG jcifs.internal.smb2.create.Smb2CreateResponse - Opened test1.txt: 84020000CD00000001000000CD000000 11:41:08.855 [main] DEBUG jcifs.smb.SmbTransportImpl - Error code: 0xC0000011 for Smb2ReadRequest 11:41:08.857 [main] DEBUG jcifs.smb.SmbTreeConnection - Not retrying jcifs.smb.SmbException: End of file at jcifs.smb.SmbTransportImpl.checkStatus2(SmbTransportImpl.java:1496) at jcifs.smb.SmbTransportImpl.checkStatus(SmbTransportImpl.java:1607) at jcifs.smb.SmbTransportImpl.sendrecv(SmbTransportImpl.java:1014) at jcifs.smb.SmbTransportImpl.send(SmbTransportImpl.java:1578) at jcifs.smb.SmbSessionImpl.send(SmbSessionImpl.java:409) at jcifs.smb.SmbTreeImpl.send(SmbTreeImpl.java:472) at jcifs.smb.SmbTreeConnection.send0(SmbTreeConnection.java:404) at jcifs.smb.SmbTreeConnection.send(SmbTreeConnection.java:318) at jcifs.smb.SmbTreeConnection.send(SmbTreeConnection.java:298) at jcifs.smb.SmbTreeHandleImpl.send(SmbTreeHandleImpl.java:130) at jcifs.smb.SmbTreeHandleImpl.send(SmbTreeHandleImpl.java:117) at jcifs.smb.SmbFileInputStream.readDirect(SmbFileInputStream.java:335) at jcifs.smb.SmbFileInputStream.read(SmbFileInputStream.java:278) at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:252) at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:271) at com.qiuhuanhen.springroot.infrastructure.utils.SMB23Utils.retrieveFile(SMB23Utils.java:266) at com.qiuhuanhen.springroot.infrastructure.utils.SMB23Utils.retrieveFile(SMB23Utils.java:181) at com.qiuhuanhen.springroot.infrastructure.utils.SMB23Utils.main(SMB23Utils.java:48) 11:41:08.858 [main] DEBUG jcifs.smb.SmbFileInputStream - Reached end of file jcifs.smb.SmbException: End of file at jcifs.smb.SmbTransportImpl.checkStatus2(SmbTransportImpl.java:1496) at jcifs.smb.SmbTransportImpl.checkStatus(SmbTransportImpl.java:1607) at jcifs.smb.SmbTransportImpl.sendrecv(SmbTransportImpl.java:1014) at jcifs.smb.SmbTransportImpl.send(SmbTransportImpl.java:1578) at jcifs.smb.SmbSessionImpl.send(SmbSessionImpl.java:409) at jcifs.smb.SmbTreeImpl.send(SmbTreeImpl.java:472) at jcifs.smb.SmbTreeConnection.send0(SmbTreeConnection.java:404) at jcifs.smb.SmbTreeConnection.send(SmbTreeConnection.java:318) at jcifs.smb.SmbTreeConnection.send(SmbTreeConnection.java:298) at jcifs.smb.SmbTreeHandleImpl.send(SmbTreeHandleImpl.java:130) at jcifs.smb.SmbTreeHandleImpl.send(SmbTreeHandleImpl.java:117) at jcifs.smb.SmbFileInputStream.readDirect(SmbFileInputStream.java:335) at jcifs.smb.SmbFileInputStream.read(SmbFileInputStream.java:278) at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:252) at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:271) at com.qiuhuanhen.springroot.infrastructure.utils.SMB23Utils.retrieveFile(SMB23Utils.java:266) at com.qiuhuanhen.springroot.infrastructure.utils.SMB23Utils.retrieveFile(SMB23Utils.java:181) at com.qiuhuanhen.springroot.infrastructure.utils.SMB23Utils.main(SMB23Utils.java:48) 11:41:08.858 [main] DEBUG jcifs.smb.SmbFileHandleImpl - Closing file handle FileHandle \test1.txt [fid=84020000CD00000001000000CD000000,tree=1,flags=0,access=1,attrs=0,options=0] 11:41:08.858 [main] DEBUG jcifs.internal.smb2.create.Smb2CloseRequest - Closing 84020000CD00000001000000CD000000 () 11:41:08.860 [Transport0] DEBUG jcifs.internal.smb2.create.Smb2CloseResponse - Closed 84020000CD00000001000000CD000000 () 11:41:08.861 [main] DEBUG jcifs.smb.SmbTreeConnection - Tree connection no longer in use, release tree SmbTree[share=TEST,service=null,tid=1,inDfs=false,inDomainDfs=false,connectionState=2,usage=2] 11:41:08.861 [main] DEBUG jcifs.smb.SmbTreeImpl - Usage dropped to zero, release session 11:41:08.861 [main] DEBUG jcifs.smb.SmbSessionImpl - Usage dropped to zero, release connection Transport0[0.0.0.0<00>/192.168.1.161:445,state=3,signingEnforced=false,usage=1] 11:41:08.861 [main] DEBUG jcifs.smb.SmbTransportPoolImpl - Closing pool 11:41:08.861 [main] DEBUG jcifs.smb.SmbTransportImpl - Disconnecting transport Transport0[0.0.0.0<00>/192.168.1.161:445,state=5,signingEnforced=false,usage=0] 11:41:08.861 [main] DEBUG jcifs.smb.SmbSessionImpl - Logging off session on Transport0[0.0.0.0<00>/192.168.1.161:445,state=5,signingEnforced=false,usage=1] 11:41:08.861 [main] DEBUG jcifs.smb.SmbSessionImpl - Disconnect tree on logoff 11:41:08.861 [main] DEBUG jcifs.smb.SmbSessionImpl - Reacquire transport 11:41:08.861 [main] DEBUG jcifs.util.transport.Transport - Trying to connect a disconnected transport 11:41:08.862 [main] DEBUG jcifs.smb.SmbSessionImpl - Usage dropped to zero, release connection Transport0[0.0.0.0<00>/192.168.1.161:445,state=5,signingEnforced=false,usage=2] 11:41:08.862 [main] DEBUG jcifs.util.transport.Transport - Trying to connect a disconnected transport 11:41:08.863 [main] DEBUG jcifs.smb.SmbTransportPoolImpl - Scheduling transport connection for removal Transport0[0.0.0.0<00>/192.168.1.161:445,state=5,signingEnforced=false,usage=0] (388104475) 11:41:08.863 [Transport0] DEBUG jcifs.util.transport.Transport - Disconnected 11:41:08.863 [main] DEBUG jcifs.smb.SmbTransportPoolImpl - Removing transport connection Transport0[0.0.0.0<00>/192.168.1.161:445,state=6,signingEnforced=false,usage=0] (388104475) 11:41:08.863 [Transport0] DEBUG jcifs.util.transport.Transport - Exception without a request pending java.net.SocketException: Socket closed at java.base/java.net.SocketInputStream.socketRead0(Native Method) at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115) at java.base/java.net.SocketInputStream.read(SocketInputStream.java:168) at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140) at jcifs.util.transport.Transport.readn(Transport.java:70) at jcifs.smb.SmbTransportImpl.peekKey(SmbTransportImpl.java:828) at jcifs.util.transport.Transport.loop(Transport.java:420) at jcifs.util.transport.Transport.run(Transport.java:779) at java.base/java.lang.Thread.run(Thread.java:834) Disconnected from the target VM, address: '127.0.0.1:61763', transport: 'socket'
logger config :
logging: level: root: error
java code:
from testing , the file download success,but the SmbException and SocketException makes me feel puzzled , I don't know how it occured