fix(worker): unregister-first shutdown cleanup order, guarded + logged (#175, R21-K10)
ci / nightly-windev (push) Has been skipped
ci / windows-x86 (push) Successful in 1m32s
ci / java (push) Successful in 2m21s
ci / portable (push) Failing after 4m30s

ShutdownGracefully now Unregisters every server handle first (MXAccess drops its
items and advise subscriptions with it). Only for a server whose Unregister fails
does the UnAdvise -> RemoveItem fallback run. Each step is guarded, logged at Debug,
and the method is idempotent. #176 (AuthenticateUser cache) is unaffected.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-10 04:26:55 -05:00
parent ace12f81ad
commit 53562ddc17
3 changed files with 125 additions and 12 deletions
+4 -1
View File
@@ -228,7 +228,10 @@ Shutdown:
1. Mark the command queue as completing.
2. Drain or reject pending commands according to shutdown mode.
3. Optionally issue MXAccess cleanup calls for active handles.
3. Issue MXAccess cleanup: `Unregister` every tracked server handle first (MXAccess removes
its items and advise subscriptions with it). Only for a server whose `Unregister` failed,
fall back to `UnAdvise` then `RemoveItem` over its remaining handles. Each step is
guarded (a failure is recorded, never skips the rest) and logged at Debug (R21-K10, #175).
4. Detach event handlers.
5. Release COM references.
6. Uninitialize COM.