Skip to content
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

Naming the reader thread #738

Closed
kz282 opened this issue Nov 3, 2021 · 3 comments
Closed

Naming the reader thread #738

kz282 opened this issue Nov 3, 2021 · 3 comments

Comments

@kz282
Copy link

kz282 commented Nov 3, 2021

I would like to ask for a cosmetic change: please allow naming the net.schmizz.sshj.transport.Reader thread.

I am facing some issues during ssh connections and it is hard to find out the internals of the connection as the internal logs contain no specific id of the connection. It would be easier to filter logs based on thread names if the connected device ip address and some other ids could be put into the reader thread name. It could be stored in the net.schmizz.sshj.Config implementations. A Config.getReaderThreadName() and setReaderThreadName(String name) would be nice.

21.11.03 09:35:10.520 INFO TransportImpl [reader]: Received SSH_MSG_DISCONNECT (reason=PROTOCOL_ERROR, msg=Too many authentication failures for testuser)
21.11.03 09:35:10.520 ERROR TransportImpl [reader]: Dying because - Too many authentication failures for testuser
net.schmizz.sshj.transport.TransportException: Too many authentication failures for testuser
at net.schmizz.sshj.transport.TransportImpl.gotDisconnect(TransportImpl.java:565) ~[sshj-0.31.0.jar:0.31.0]
at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:521) ~[sshj-0.31.0.jar:0.31.0]
at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:113) ~[sshj-0.31.0.jar:0.31.0]
at net.schmizz.sshj.transport.Decoder.received(Decoder.java:203) ~[sshj-0.31.0.jar:0.31.0]
at net.schmizz.sshj.transport.Reader.run(Reader.java:60) ~[sshj-0.31.0.jar:0.31.0]
21.11.03 09:35:10.520 INFO TransportImpl [reader]: Disconnected - PROTOCOL_ERROR
21.11.03 09:35:10.520 DEBUG KeyExchanger [reader]: Got notified of net.schmizz.sshj.transport.TransportException: [PROTOCOL_ERROR] Too many authentication failures for testuser
21.11.03 09:35:10.520 DEBUG UserAuthImpl [reader]: Notified of net.schmizz.sshj.transport.TransportException: [PROTOCOL_ERROR] Too many authentication failures for testuser
21.11.03 09:35:10.520 DEBUG TransportImpl [reader]: Setting active service to null-service
21.11.03 09:35:10.521 DEBUG Promise [reader]: Setting <> to SOME
21.11.03 09:35:10.521 DEBUG Reader [reader]: Stopping

exceptionfactory added a commit to exceptionfactory/sshj that referenced this issue Dec 21, 2021
- Added ThreadNameProvider to set name based on Thread Class and remote socket address
- Added RemoteAddressProvider to abstract access to Remote Socket Address
- Set Reader Thread name in TransportImpl
- Set SFTP PacketReader Thread name in SFTPEngine
- Set KeepAlive Thread name in SSHClient
exceptionfactory added a commit to exceptionfactory/sshj that referenced this issue Dec 21, 2021
- Added ThreadNameProvider to set name based on Thread Class and remote socket address
- Added RemoteAddressProvider to abstract access to Remote Socket Address
- Set Reader Thread name in TransportImpl
- Set SFTP PacketReader Thread name in SFTPEngine
- Set KeepAlive Thread name in SSHClient
exceptionfactory added a commit to exceptionfactory/sshj that referenced this issue Dec 22, 2021
- Added ThreadNameProvider to set name based on Thread Class and remote socket address
- Added RemoteAddressProvider to abstract access to Remote Socket Address
- Set Reader Thread name in TransportImpl
- Set SFTP PacketReader Thread name in SFTPEngine
- Set KeepAlive Thread name in SSHClient
hierynomus added a commit that referenced this issue Dec 23, 2021
- Added ThreadNameProvider to set name based on Thread Class and remote socket address
- Added RemoteAddressProvider to abstract access to Remote Socket Address
- Set Reader Thread name in TransportImpl
- Set SFTP PacketReader Thread name in SFTPEngine
- Set KeepAlive Thread name in SSHClient

Co-authored-by: Jeroen van Erp <jeroen@hierynomus.com>
@jkosternl
Copy link

@kz282, can you please close this request, since it was merged already in the past? Otherwise state what is still missing/wrong.

@hierynomus
Copy link
Owner

Closing indeed... Should be checking the git commit messages better for the wording so that the issues get closed automatically ;)

@kz282
Copy link
Author

kz282 commented Nov 4, 2022

Testing with 0.26.0:
2022-10-27 23:38:37.606 TRACE transport.TransportImpl(497) [reader]: Received packet KEXDH_31

Testing with 0.34.0
2022-11-04 10:02:43.461 TRACE transport.TransportImpl(480) [sshj-Reader-/10.1.2.3:22]: Received packet KEXDH_31

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants