Skip to content

Reset noContextManagerReceived when requesting session state - #1047

Open
lihongyi87 wants to merge 1 commit into
apache:mainfrom
lihongyi87:fix-deltamanager-ncm-reset-clean
Open

Reset noContextManagerReceived when requesting session state#1047
lihongyi87 wants to merge 1 commit into
apache:mainfrom
lihongyi87:fix-deltamanager-ncm-reset-clean

Conversation

@lihongyi87

Copy link
Copy Markdown
Contributor

Problem

noContextManagerReceived is set to true when EVT_ALL_SESSION_NOCONTEXTMANAGER is received and is never reset. getAllClusterSessions() resets stateTransferred before requesting session state but leaves noContextManagerReceived set.

Because waitForSendAllSessions() includes !isNoContextManagerReceived() in its loop condition, every subsequent state transfer on the same manager instance returns immediately — even when the cluster node now has a context manager and sends session state. The sessions are skipped.

The flag has existed since it was introduced in 2011 (r1195384) without a reset.

Trigger

A manager instance receives ALL_SESSION_NOCONTEXTMANAGER (peer not yet deployed), then the same instance requests session state again — for example after a web application reload (reloadable=true) reuses the manager.

Fix

Reset the flag alongside stateTransferred when requesting session state, so the wait is governed only by the response to the current request.

Testing

Two tests in TestDeltaManagerStateTransfer verify both flags are reset when getAllClusterSessions() is called with a mocked cluster member. On unpatched code the noContextManagerReceived test fails; with the fix both pass.

The flag is set when EVT_ALL_SESSION_NOCONTEXTMANAGER is received and is
never reset. getAllClusterSessions() resets stateTransferred before
requesting session state but leaves noContextManagerReceived set, so
waitForSendAllSessions() returns immediately for every subsequent state
transfer on the same manager instance, skipping sessions the cluster
does send. Reset the flag alongside stateTransferred.
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

Successfully merging this pull request may close these issues.

1 participant