prosgarz35 commented on PR #3198:
URL: https://github.com/apache/james-project/pull/3198#issuecomment-5807345596

       ### Incremental Refinement: Complete idleReadySink on Cleanup & Strict 
LOGOUT Check
   
       Addressed the latest review comments regarding the synchronization sink 
lifecycle and command matching:
   
       1. **Atomic `idleReadySink` Completion during Cleanup (`cleanupIdle`)**:
          - **Problem**: Previously, `idleReadySink` was only signaled in 
`doFinally` of `processRequestReactive` and in `unselected IDLE`. If a 
connection dropped abruptly or an error occurred during heartbeat/event push, 
background
     tasks were torn down via `cleanupIdle(...)`, but `idleReadySink` remained 
incomplete until the outer pipeline reached completion. Any pending reactive 
subscribers waiting on `idleReadySink.asMono()` risked lingering in memory,
     holding onto `IdleMailboxListener`, `Responder`, and `ImapSession`.
          - **Fix**: Passed `idleReadySink` into `cleanupIdle(...)` and invoke 
`idleReadySink.tryEmitEmpty()` within the atomic CAS block 
(`idleActive.compareAndSet(true, false)`).
          - **Benefit**: Ensures deterministic, immediate completion of all 
reactive flows and releases associated memory references as soon as cleanup is 
triggered.
   
       2. **Strict Exact Command Matching for Mid-IDLE `LOGOUT`**:
          - **Refinement**: Replaced regex pattern matching with exact string 
comparison (`"LOGOUT".equals(upper)`). If the client sends an exact `LOGOUT` 
command while idling, the session gracefully triggers `return 
session1.logout()`.
     Any other continuation string is handled as an invalid continuation via 
RFC-compliant tagged `BAD INVALID_CONTINUATION`.
   
       #### Verification
       - Clean Maven compilation across `:protocols-imap` and 
`:james-server-protocols-imap4`.
       - Checkstyle: **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