-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need to understand - com.hierynomus.smbj.session.Session.logoff:Line 193 - Caught exception while closing TreeConnect with id: 1 com.hierynomus.protocol.transport.TransportException: java.net.SocketException: Connection reset #316
Comments
What is the server OS and version? |
Hi @hierynomus at com.hierynomus.smbj.transport.PacketReader.run(PacketReader.java:53) [smbj-0.5.0.jar:?] If it is not critical then please suggest us how to disable those error logs from SMBJ 0.5.0 library? As per our understanding, SMBJ creates Packet Reader for xxx server thread for each connection |
Could you test with a more recent version of the library and see if you still get the same problem? |
Okay..We will try to check same with latest library 0.7.0 and will let you know |
Hi. @pepijnve / @hierynomus , Below two types of file server on which we do this testing and same exception we faced.
|
Hi @hierynomus / @pepijnve And same time, we monitored JVM threads and found multiple packet reader threads are in running state and not stopping/releasing the threads. You can see attached JVM monitor file here for more details. You can see attached stack trace here. |
Hi @hierynomus / @pepijnve Cause:- Actually we have used SMBJ connection code for different file operations(e.g. file upload/download/delete/rename etc.) in our product. Earlier code
I don't know why it behaves like as above described. Because as far as i understand try-with-resources and finally block close should behave the same. |
@hierynomus please help us know if the issue is fixed ? |
In my case, the reason was that I had opened several connections to a Windows server in different Tasks. Starting PacketReader on thread: Packet Reader for XXXX I had also set the sotimeout of the SMBClient to 2 minutes. What I then noticed was that the response packets to various requests occasionally ran into a timeout. |
Different connection do not share anything underneath... From what you're writing, this sounds like a server-side problem where it mixes up the clients, because they receive a timeout when waiting for the response. |
Yes, it sounds crazy, but the counterpart is a Windows 10 PC, so it is not exotic and I have run the java program under Linux and Windows. |
I have dump a part of the logfile with the perhaps important information. Look to connectTree and disconnectTree. It is always a pair of connectTree and disconnectTree, but at 13:53:34.055 (bold lines) I have two connects but only one disconnect for it. At the bottom you can see the Error Message. The disconnect for the diskshare of session 312277005762565 hangs. 13:53:33.694 [main] INFO com.hierynomus.smbj.session.Session com.hierynomus.smbj.session.Session 120 connectTree - Connecting to \w10-naber.alfa.de\temp on session 312277005762581 |
Sometimes it helps to capature the packets with wireshark :-)
Perhaps you have to move up the lock at logoff() Function in the Session Class
|
Forget my last post. I checked out the current sources, inserted debug messages in various places and recorded the packets using Wireshark. Unfortunately, the packets in question are encrypted, so the only way to find out whether the error is in the programme or whether there really is no response from the Windows system is to look at the number of packets sent and answered. After many tests I had to find out that with a small sotimeout and transactiontimeout at the smbclient the answer from Windows does not arrive. Only when I set these values very high did the error messages disappear. So smbj is doing everything right. Slow and steady wins the race. |
Closing this ticket, it seems to be resolved. |
Hi @hierynomus & @pepijnve ,
We have use SMBJ 0.5.0 library in UAT environment and we found below error on some frequent basis. The same we were not encounter in LOCAL environment. Can you please help me to understand this error?
Also is this critical error or this is generated due to I missed something in my code.
I have used below Code for closing resources of SMBJ
Thanks.
Exception:
4/23/1810:49:30.328 AM | ERROR [uathqasg1] [2018-04-23T10:49:30,328] - com.hierynomus.smbj.session.Session.logoff:Line 193 - Caught exception while closing TreeConnect with id: 1 com.hierynomus.protocol.transport.TransportException: java.net.SocketException: Connection reset by peer: socket write error at com.hierynomus.smbj.transport.tcp.direct.DirectTcpTransport.write(DirectTcpTransport.java:77) ~[smbj-0.5.0.jar:?] at com.hierynomus.smbj.connection.Connection.send(Connection.java:252) ~[smbj-0.5.0.jar:?] at com.hierynomus.smbj.session.Session.send(Session.java:242) ~[smbj-0.5.0.jar:?] at com.hierynomus.smbj.share.TreeConnect.close(TreeConnect.java:61) ~[smbj-0.5.0.jar:?] at com.hierynomus.smbj.share.Share.close(Share.java:92) ~[smbj-0.5.0.jar:?] at com.hierynomus.smbj.session.Session.logoff(Session.java:191) [smbj-0.5.0.jar:?] at com.hierynomus.smbj.session.Session.close(Session.java:224) [smbj-0.5.0.jar:?] at com.hierynomus.smbj.connection.Connection.close(Connection.java:135) [smbj-0.5.0.jar:?] at com.hierynomus.smbj.connection.Connection.close(Connection.java:120) [smbj-0.5.0.jar:?] at com.hierynomus.smbj.connection.Connection.handleError(Connection.java:415) [smbj-0.5.0.jar:?] at com.hierynomus.smbj.transport.PacketReader.run(PacketReader.java:53) [smbj-0.5.0.jar:?] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_152] Caused by: java.net.SocketException: Connection reset by peer: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) ~[?:1.8.0_152] at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111) ~[?:1.8.0_152] at java.net.SocketOutputStream.write(SocketOutputStream.java:155) ~[?:1.8.0_152] at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) ~[?:1.8.0_152] at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140) ~[?:1.8.0_152] at com.hierynomus.smbj.transport.tcp.direct.DirectTcpTransport.write(DirectTcpTransport.java:74) ~[smbj-0.5.0.jar:?] ... 11 moreCollapse
The text was updated successfully, but these errors were encountered: