Skip to content

Impossible to correlate logs from NIO worker threads #904

Description

@baiglin

Version

2.18.0

Bug description

Hi,

We have sometimes the need to enable DEBUG logs to see what is happening in more details, the window adjustment messages etc... to investigate issues. Lately we have a problem with a server where some connections are fast, we create different channels in the same sessions, and they are all slow but if we create a new connections, it is fast. As a workaround we have implemented a way to renew the connections if it is opened for more than x minutes.
And when we open new session, then the transfer is fast again. It is really hard to understand what could cause this slowness, for that we enabled debug logs on mina, but we do not know how to correlate the logs from nio threads as we loose the mdc context and we have a lot of different logs!

Is there a way to correlate the logs ?

I know there are listeners that we could implement but obviously it does not cover all cases.

Actual behavior

Lot of logs from different threads without common client session identifier

Expected behavior

Be able to propagate MDC context to correlate logs

Relevant log output

[sshd-SshClient[f237ae7]-nio2-thread-1][common-transfer] DEBUG o.a.s.c.s.ClientSessionImpl doHandleMessage(ClientSessionImpl[adds.user@localhost/127.0.0.1:62253]) process #5 SSH_MSG_CHANNEL_OPEN_CONFIRMATION
2026-06-24 12:37:30,656 [sshd-SshClient[f237ae7]-nio2-thread-1][common-transfer] DEBUG o.a.s.c.s.ClientConnectionService channelOpenConfirmation(SftpChannelSubsystem[id=0, recipient=-1]-ClientSessionImpl[adds.user@localhost/127.0.0.1:62253][sftp]) SSH_MSG_CHANNEL_OPEN_CONFIRMATION sender=0, window-size=2097152, packet-size=32768
2026-06-24 12:37:30,656 [sshd-SshClient[f237ae7]-nio2-thread-1][common-transfer] DEBUG o.a.s.s.c.i.DefaultSftpClient$SftpChannelSubsystem setRecipient(SftpChannelSubsystem[id=0, recipient=-1]-ClientSessionImpl[adds.user@localhost/127.0.0.1:62253][sftp]) recipient=0
2026-06-24 12:37:30,656 [sshd-SshClient[f237ae7]-nio2-thread-1][common-transfer] DEBUG o.a.s.c.c.RemoteWindow init(RemoteWindow[client](SftpChannelSubsystem[id=0, recipient=0]-ClientSessionImpl[adds.user@localhost/127.0.0.1:62253][sftp])) size=2097152, max=2097152, packet=32768

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions