unscoped thread variable not being found

Environment

None

Attachments

4
  • 20 Mar 2020, 10:13 am
  • 20 Mar 2020, 10:12 am
  • 20 Mar 2020, 10:12 am
  • 20 Mar 2020, 10:11 am

Activity

Show:

Zac Spitzer 18 October 2022 at 15:36

moved the second part of this original ticket to https://luceeserver.atlassian.net/browse/LDEV-4244

Pothys - MitrahSoft 18 October 2022 at 13:37
Edited

I think we have to add a new check and use pc.getCurrentThreadScope() to search the undefined scope inside the thread.
https://trycf.com/gist/70a93d54de43ba4df2202c6abc2f58bb/lucee5?theme=monokai

// search in the thread scope if (pc.hasFamily() && ((PageContextImpl) pc).getCurrentThreadScope() != null) { rtn = ((PageContextImpl) pc).getCurrentThreadScope().get(key, _null); if (rtn != _null) { if (debug && !((PageContextImpl) pc).isThreads(rtn)) debugCascadedAccess(pc, "thread", key); return rtn; } }

Pothys - MitrahSoft 18 October 2022 at 12:30

Inside the thread while searching for the undefined variable, the UndefinedImpl class pc.getThreadScope(key, _null) searches for the child threads and it returns the child thread if it exists, not thread scope.
https://github.com/lucee/Lucee/blob/6.0/core/src/main/java/lucee/runtime/type/scope/UndefinedImpl.java#L222
Example: https://trycf.com/gist/5b2e61bda178224bff3d423807de9fdf/lucee5?theme=monokai

Zac Spitzer 18 October 2022 at 11:02
Edited

testcase for accessing a unscoped thread scope variable inside a thread

https://github.com/lucee/Lucee/pull/1850

[java] [script] testThreadUnscopedVar [java] [script] [java] [script] Errored: variable [TEST2773] doesn't exist [java] [script] [java] [script] C:\work\lucee6\test\tickets\LDEV2773.cfc:9 [java] [script] [java] [script] [java] [script] lucee.runtime.exp.ExpressionException: variable [TEST2773] doesn't exist [java] [script] [java] [script] at lucee.runtime.type.scope.UndefinedImpl.get(UndefinedImpl.java:243) [java] [script] at lucee.runtime.type.scope.UndefinedImpl.get(UndefinedImpl.java:184) [java] [script] at tickets.ldev2773_cfc$cf.threadCall(/test/tickets/LDEV2773.cfc:9) [java] [script] at lucee.runtime.thread.ChildThreadImpl.execute(ChildThreadImpl.java:206) [java] [script] at lucee.runtime.thread.ChildThreadImpl.run(ChildThreadImpl.java:147)

https://github.com/lucee/Lucee/blob/6.0/core/src/main/java/lucee/runtime/type/scope/UndefinedImpl.java#L220

Details

Assignee

Reporter

Priority

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

Affects versions

Created 20 March 2020 at 10:16
Updated 28 October 2022 at 13:48

Flag notifications