fix(cli): guard onSessionEnd via applicationScope.wo (#3379) - #3394
Merged
Conversation
Fails on current develop: every shipped onSessionEnd still dereferences live application.wo.$simpleLock. Refs #3379 Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.com>
Adobe's session reaper can call onSessionEnd after the live application scope is already torn down. Route $simpleLock through arguments.applicationScope.wo and no-op when wo is missing. Refs #3379 Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peter Amiri <peter@alurium.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Guard
onSessionEndthe same way #3381 guardedonApplicationEnd. Adobe's session reaper (SessionTracker.SessionCleanUpAgent) callsonSessionEndafter the live application scope can already be torn down. Bareapplication.wo.$simpleLockthen throwsElement wo is undefined in a Java object of type class [Ljava.lang.String;and the site stays dead until a CF service restart.Mike already applied the #3381
onApplicationEndpaste; the crash continues atpublic/Application.cfconSessionEnd.This PR routes
$simpleLockthrougharguments.applicationScope.woand no-ops whenwois missing. Only thewoStructKeyExistsguard is added — this path does not$include, so thewheels/eventPathchecks fromonApplicationEndare intentionally omitted.Related Issue
Refs #3379
Type of Change
What is broken
SessionTracker.SessionCleanUpAgentinvokesonSessionEndafter the live application scope can already be reclaimed.application.wo.$simpleLockinonSessionEnd.onApplicationEndpaste does not cover this handler.What was verified
Application.cfccopies still had the unguardedapplication.wo.$simpleLockinonSessionEndon develop before the fix:cli/lucli/templates/app/public/Application.cfc(canonicalwheels newtemplate)public/Application.cfc(repo demo)examples/starter-app/public/Application.cfcexamples/tweet/public/Application.cfcapplication.woinonSessionStart/onRequestStart/onRequestEnd/onMissingTemplateis left alone. Those handlers do not receiveapplicationScopeand run on a live request.onApplicationEndis unchanged (already shipped via test(cli): cover every shipped onApplicationEnd handler for #3379 #3381).Spec coverage
vendor/wheels/tests/specs/cli/OnSessionEndScopeGuardSpec.cfcmirrorsOnApplicationEndScopeGuardSpec:cli/lucli/templates,public/,examples/for every shippedApplication.cfcthat declaresonSessionEnd.onSessionEndbody:application.wo.dereferencearguments.applicationScope.wo.StructKeyExists(arguments.applicationScope, "wo")appears before the dereferenceTDD: first commit is the failing spec alone; second commit is the four-file guard + changelog fragment so the spec passes.
Existing 4.0.x apps
Existing apps must paste the same
onSessionEndedit into their ownpublic/Application.cfc. Framework upgrades do not rewrite an already-scaffolded application bootstrap.Feature Completeness Checklist
Signed-off-by:(usegit commit -s); see CONTRIBUTING.mdonSessionEndhandler.aisibling of the onApplicationEnd invariant).ai/wheels/cross-engine-compatibility.mdonSessionEnd)changelog.d/3379-onsessionend-scope-guard.fixed.mdTest Plan
CI that must go green:
Screenshots / Output
N/A — structural source-shape guard. Real Adobe session-reaper teardown cannot be reproduced inside a spec without killing the runner.