SessionRotate() causes onSessionEnd() not to run

I log lifecycle calls on onSessionStart and onSessionEnd. I rotate the session when a stale CFID cookie is received from a client. But, I find that when rotated, onSessionEnd does not fire. However, the session does indeed end. If no SessionRotate() was called, then it behaves normally, and OnSessionEnd executes.

My log entries:

No SessionRotate():

“INFO”,“http-nio-8801-exec-6”,“04/28/2021”,“14:01:32”,“mpos-main-20210428001”,“onSessionStart(): Session Started; CFID=b81a11f8-e831-4975-b049-6598125b3850”

“INFO”,“Thread-1803”,“04/28/2021”,“14:06:33”,“mpos-main-20210428001”,“onSessionEnd(): Session ended; CFID=b81a11f8-e831-4975-b049-6598125b3850”

Session was rotated:

“INFO”,“http-nio-8801-exec-9”,“04/28/2021”,“14:06:48”,“mpos-main-20210428001”,“onSessionStart(): Session Started; CFID=b81a11f8-e831-4975-b049-6598125b3850”

“INFO”,“http-nio-8801-exec-9”,“04/28/2021”,“14:06:48”,“mpos-main-20210428001”,“onSessionStart(): CFID Cookie found: b81a11f8-e831-4975-b049-6598125b3850”

“INFO”,“http-nio-8801-exec-9”,“04/28/2021”,“14:06:48”,“mpos-main-20210428001”,“onSessionStart(): Session Rotated; old CFID=b81a11f8-e831-4975-b049-6598125b3850 | new CFID=04acadab-1dc7-47c6-9823-d13df18c621f”

Note, no OnSessionend log after timeout nor even waiting for some time.

[LDEV-2422] Lucee sessions are set with NO timeout when using an empty onSessionStart() - Lucee seems partially relevant (?), but I’m not using the cache for session storage and am running Lucee

Another scenario that produces a -1 is if you set ANY session variables in the life-cycle and you run an sessionInvalidate() at the end of the request. This also creates an enternal entry in the cache with a -1 TTL.

I have filed a bug LDEV-3478

Thanks for confirming!