Session variables set after thread join are being lost - sessionCluster=true
Activity
Zac Spitzer 11 February 2025 at 17:00
here’s local passing
[java] [script] thread looses session variables - redis - sessionCluster=true
[java] [script] "INFO","main","02/11/2025","17:50:08","scope-context","Create new [session] scope for [ldev-2135-thread-session-cfml-true-redis/fe1c44e4-4bf5-41fd-9c3c-92e19f08d613] in cache [redissession]"
[java] [script] at lucee.aprint.printStackTrace(aprint.java:81)
[java] [script] at lucee.aprint.ds(aprint.java:72)
[java] [script] at lucee.aprint.ds(aprint.java:99)
[java] [script] at lucee.runtime.type.scope.storage.IKHandlerCache.loadData(IKHandlerCache.java:49)
[java] [script] at lucee.runtime.type.scope.storage.IKStorageScopeSupport.getInstance(IKStorageScopeSupport.java:140)
[java] [script] at lucee.runtime.type.scope.ScopeContext.getCFSessionScope(ScopeContext.java:530)
[java] [script] at lucee.runtime.type.scope.ScopeContext.getSessionScope(ScopeContext.java:401)
[java] [script] at lucee.runtime.PageContextImpl.sessionScope(PageContextImpl.java:1692)
[java] [script] at lucee.runtime.PageContextImpl.sessionScope(PageContextImpl.java:1686)
[java] [script] at tickets.ldev2135.cfml_session225.testthreadsession_cfm$cf.call(/test-never/tickets/LDEV2135/cfml-session/testThreadSession.cfm:3)
[java] [script] at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1096)
[java] [script] at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:990)
[java] [script] at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:213)
[java] [script] at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:41)
[java] [script] at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2788)
[java] [script] at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2775)
[java] [script] at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2746)
[java] [script] at lucee.runtime.functions.system.InternalRequest.call(InternalRequest.java:134)
[java] [script] at tickets.ldev2135_cfc$cf.udfCall2(/test/tickets/LDEV2135.cfc:53)
[java] [script] at tickets.ldev2135_cfc$cf.udfCall(/test/tickets/LDEV2135.cfc)
[java] [script] at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
[java] [script] at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357)
[java] [script] at lucee.runtime.type.UDFImpl.call(UDFImpl.java:224)
[java] [script] at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:785)
[java] [script] at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:797)
[java] [script] "INFO","main","02/11/2025","17:50:08","scope-context","Store scope for [ldev-2135-thread-session-cfml-true-redis/fe1c44e4-4bf5-41fd-9c3c-92e19f08d613] in cache [redissession]"
[java] [script] "INFO","main","02/11/2025","17:50:08","scope-context","Store scope for [ldev-2135-thread-session-cfml-true-redis/fe1c44e4-4bf5-41fd-9c3c-92e19f08d613] in cache [redissession]"
[java] [script] {"SESSIONSTORAGE":"redis","SESSIONCLUSTER":true}
[java] [script] -- before secondRequest.cfm
[java] [script] "INFO","main","02/11/2025","17:50:08","scope-context","Load existing data from cache [redissession] to create session scope for ldev-2135-thread-session-cfml-true-redis/fe1c44e4-4bf5-41fd-9c3c-92e19f08d613"
[java] [script] "INFO","main","02/11/2025","17:50:08","scope-context","Store scope for [ldev-2135-thread-session-cfml-true-redis/fe1c44e4-4bf5-41fd-9c3c-92e19f08d613] in cache [redissession]"
same failing on GHA, timing issue?
[INFO] [java] [script] thread looses session variables - redis - sessionCluster=true
[INFO] [java] [script] "INFO","main","02/11/2025","16:56:32","scope-context","Create new [session] scope for [ldev-2135-thread-session-cfml-true-redis/a615af8b-1ee9-445e-803b-046867df9ca3] in cache [redissession]"
[INFO] [java] [script] at lucee.aprint.printStackTrace(aprint.java:81)
[INFO] [java] [script] at lucee.aprint.ds(aprint.java:72)
[INFO] [java] [script] at lucee.aprint.ds(aprint.java:99)
[INFO] [java] [script] at lucee.runtime.type.scope.storage.IKHandlerCache.loadData(IKHandlerCache.java:49)
[INFO] [java] [script] at lucee.runtime.type.scope.storage.IKStorageScopeSupport.getInstance(IKStorageScopeSupport.java:140)
[INFO] [java] [script] at lucee.runtime.type.scope.ScopeContext.getCFSessionScope(ScopeContext.java:530)
[INFO] [java] [script] at lucee.runtime.type.scope.ScopeContext.getSessionScope(ScopeContext.java:401)
[INFO] [java] [script] at lucee.runtime.PageContextImpl.sessionScope(PageContextImpl.java:1692)
[INFO] [java] [script] at lucee.runtime.PageContextImpl.sessionScope(PageContextImpl.java:1686)
[INFO] [java] [script] at tickets.ldev2135.cfml_session225.testthreadsession_cfm$cf.call(/test-never/tickets/LDEV2135/cfml-session/testThreadSession.cfm:3)
[INFO] [java] [script] at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:1096)
[INFO] [java] [script] at lucee.runtime.PageContextImpl._doInclude(PageContextImpl.java:990)
[INFO] [java] [script] at lucee.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:213)
[INFO] [java] [script] at lucee.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:41)
[INFO] [java] [script] at lucee.runtime.PageContextImpl.execute(PageContextImpl.java:2788)
[INFO] [java] [script] at lucee.runtime.PageContextImpl._execute(PageContextImpl.java:2775)
[INFO] [java] [script] at lucee.runtime.PageContextImpl.executeCFML(PageContextImpl.java:2746)
[INFO] [java] [script] at lucee.runtime.functions.system.InternalRequest.call(InternalRequest.java:134)
[INFO] [java] [script] at tickets.ldev2135_cfc$cf$w0.udfCall2(/test/tickets/LDEV2135.cfc:53)
[INFO] [java] [script] at tickets.ldev2135_cfc$cf$w0.udfCall(/test/tickets/LDEV2135.cfc)
[INFO] [java] [script] at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:112)
[INFO] [java] [script] at lucee.runtime.type.UDFImpl._call(UDFImpl.java:357)
[INFO] [java] [script] at lucee.runtime.type.UDFImpl.call(UDFImpl.java:224)
[INFO] [java] [script] at lucee.runtime.type.scope.UndefinedImpl.call(UndefinedImpl.java:785)
[INFO] [java] [script] at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:797)
[INFO] [java] [script] "INFO","main","02/11/2025","16:56:32","scope-context","Store scope for [ldev-2135-thread-session-cfml-true-redis/a615af8b-1ee9-445e-803b-046867df9ca3] in cache [redissession]"
[INFO] [java] [script] "INFO","main","02/11/2025","16:56:32","scope-context","Store scope for [ldev-2135-thread-session-cfml-true-redis/a615af8b-1ee9-445e-803b-046867df9ca3] in cache [redissession]"
[INFO] [java] [script] {"SESSIONSTORAGE":"redis","SESSIONCLUSTER":true}
[INFO] [java] [script] -- before secondRequest.cfm
[INFO] [java] [script] "INFO","main","02/11/2025","16:56:32","scope-context","Load existing data from cache [redissession] to create session scope for ldev-2135-thread-session-cfml-true-redis/a615af8b-1ee9-445e-803b-046867df9ca3"
[INFO] [java] [script] "INFO","main","02/11/2025","16:56:32","scope-context","Store scope for [ldev-2135-thread-session-cfml-true-redis/a615af8b-1ee9-445e-803b-046867df9ca3] in cache [redissession]"
[INFO] [java] [script]
Zac Spitzer 11 February 2025 at 14:33Edited
temp disable failing test https://github.com/lucee/Lucee/commit/abe2094a417de56c3ab4e75118b338ed2f0dfb57
https://github.com/lucee/Lucee/commit/0089e50b7f0434790b76417911f1640bf728132a
classic, works on my machine, just not on github! sigh
Zac Spitzer 11 February 2025 at 14:21
Zac Spitzer 4 February 2025 at 11:10
Zac Spitzer 3 February 2025 at 18:52Edited
@Michael Offner root cause is lastStanding being false when the PC is released, maybe due to internal request?
https://github.com/lucee/Lucee/commit/400e64ab8e405139c371c8dbb2a36a2262c33521
private boolean lastStanding() {
if (!hasFamily()) return true;
// active childern?
Queue<PageContext> tmp = this.children;
if (tmp != null) {
for (PageContext p: tmp) {
if (p.getStartTime() > 0) return false;
}
}
// active parent?
PageContext p = this;
while ((p = p.getParentPageContext()) != null) {
if (p.getStartTime() > 0) return false;
}
return false;
}
will only return true when there’s no family, everything following results in false
https://github.com/lucee/Lucee/blob/6.2/core/src/main/java/lucee/runtime/PageContextImpl.java#L781
Details
Assignee
Zac SpitzerZac SpitzerReporter
Brandon BrownBrandon BrownPriority
MajorLabels
Fix versions
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Sprint
Details
Details
Assignee
Reporter
Priority
Labels
Fix versions
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
In the code below if you run it multiple times you will see that only one key survives requests. Anything set after the thread join is lost on the next page request.
UPDATE: Tested with CF2018 and it works as expected.
UPDATE: It appears it will break when setting "this.sessionCluster=true" inside of application.cfc. We are using the following configuration:
this.sessionManagement=true; this.setClientCookies=true; this.sessionStorage="cfsessions"; this.sessionCluster=true;
<cfscript> if(!structKeyExists(session, 'mySessionStruct')) { session.mySessionStruct = {}; } writedump(session.mySessionStruct) session.mySessionStruct.ISurvive = 'survived'; for(i in [1,2,3,4,5]) { thread name="run#i#" { try { sleep(1000); throw(type="blah", message="boom"); } catch(any e) { writedump(session.mySessionStruct); } } } thread action="join" name=cfthread.keyList(); session.mySessionStruct.IAmLost = 'goodbye'; writedump(session.mySessionStruct); </cfscript>