Static variable values seem to occasionally "reset"

Description

Consider this code:

// Number.cfc component { static { number = 0 } public void function setNumber(number){ Number::number = number } public numeric function getNumber(){ return Number::number } }
// number.cfm number1 = new Number() number2 = new Number() dump(var={ number1 = number1.getNumber(), number2 = number2.getNumber() }, label="Initial state") number1.setNumber(42) dump(var={ number1 = number1.getNumber(), number2 = number2.getNumber() }, label="After updating via number1") dump(var={ number1 = Number::number, }, label="Direct access")

When I run this, I get:

Initial state Struct NUMBER1 number 0 NUMBER2 number 0 After updating via number1 Struct NUMBER1 number 42 NUMBER2 number 42 Direct access Struct NUMBER1 number 42

On subsequent hits to number.cfm, I get this:

Initial state Struct NUMBER1 number 42 <--- note the value reflects the previous change still NUMBER2 number 42 After updating via number1 Struct NUMBER1 number 42 NUMBER2 number 42 Direct access Struct NUMBER1 number 42

This is what I'd expect.

However on a couple of occasions when I've been distracted for some period of time (could be a coupla min, could be longer), and I reload that page, then the value has been reset to 0 again. This is different from the situation I detailed in issue [270].(https://bitbucket.org/lucee/lucee/issue/270). This is definitely with the "block" style syntax.

It does not seem to be based on a specific period of time (like some sort of timeout), because I've seen it in the space of a coupla minutes. However I've just left it sitting there for over half an hour, and cannot replicate. It has not been a one off though, I have seen it happen a few times whilst testing.

I dunno what else to look for by way of troubleshooting, TBH. Any ideas?

Environment

None

Activity

Michael Offner 12 June 2020 at 17:27

moved the static scope from an instance variable in ComponentImpl to be a static variable in the class created.

Michael Offner 12 June 2020 at 14:48

Most likely this happens when a page is cleared from page pool, for example when you call pagePoolClear

Michael Offner 12 June 2020 at 14:31
Edited

found and fixed the issue “Component from type [Foo] has no accessible static Member with name [bar]“

This did happen even the function in that case “bar“ was defined inside the component.

Problem was a multi threading issue, it turned out to be unrelated to this ticket, so we created an other ticket for it

https://luceeserver.atlassian.net/browse/LDEV-2932

 

Michael Offner 12 June 2020 at 09:38

when a Component is removed from Page Pool, for example when pagePoolClear() is executed, the static scope is refreshing .

Fixed

Assignee

Reporter

Priority

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

Affects versions

Created 9 April 2015 at 19:15
Updated 12 June 2020 at 17:32
Resolved 12 June 2020 at 17:32