abhiramaab opened a new pull request, #953:
URL: https://github.com/apache/mina-sshd/pull/953

   ### Summary
   
   Fixes #952.
   
   `IdentFilter.WriteHandler.send()` prematurely released its write queue guard 
using `lastWrite.compareAndSet(result, null)` inside the `queue.addListener` 
callback, before invoking `owner().send(cmd, message)`.
   
   Under concurrent message dispatch, a subsequent call to `send()` (e.g., 
`SSH_MSG_KEX_FIRST` during key exchange negotiation) could observe `lastWrite 
== null`, bypass the queue, and reach the output sink before `SSH_MSG_KEXINIT`, 
violating message ordering.
   
   ### Changes
   
   1. Moved `lastWrite.compareAndSet(result, null)` to execute after 
`owner().send(...)` in `IdentFilter.java`, ensuring the write queue remains 
guarded until the current message is handed off.
   2. Added the regression test `concurrentSendDuringKexInitDoesNotOvertake` in 
`IdentFilterTest.java` to verify that messages queued during identification and 
KEXINIT processing cannot overtake each other.
   
   ### Verification
   
   - `./mvnw test -pl sshd-core -Dtest=IdentFilterTest` passes.
   - Verified code style and formatting using `checkstyle:check`, 
`formatter:validate`, and `impsort:check`.
   
   All checks passed with **0 violations**.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to