Problem with Session dates stored in a cluster in BST

We’re noticing an issue in Lucee 5 that is not present in Lucee 4.

We have our session data stored in an MS SQL database. If we set/store a date that is after the BST cut-off, reading the date changes its value.

So:

  • MS SQL Database set to be a client/session storage.
  • Web instance is setup via a script setting the timezone to “Europe/London”

Application.cfc

component output=false persistent=false {
	this.Name = "timezonetesting";
	// General Cache settings
	Request.Cache = {};
	Request.Cache.Five = 0.00347222222222;
	Request.Cache.Ten = 0.00694444444444;
	Request.Cache.Twenty = 0.0138888888889;
	Request.Cache.Thirty = 0.0208333333333;

	// Session Information
	this.sessionType = "cfml";
	this.sessionManagement = true;
	this.sessionStorage = "SessionManager";
	this.sessionCluster = true;
	this.sessionTimeout = Request.Cache.Thirty;
	this.setClientCookies = false;
	this.setDomainCookies = false;
	this.timeZone = "Europe/London";
}

Then an index.cfm of

<cfscript>
	if (structKeyExists(URL, "Reset")) {
		structDelete(Session, "dtTest");
		structDelete(Session, "dtTest2");
	}

	if (!structKeyExists(Session, "dtTest")) {
		Session.dtTest = Now();
	}
	if (!structKeyExists(Session, "dtTest2")) {
		Session.dtTest2 = createDatetime(2017, 03, 29, 19, 00, 00);
	}

	writeDump(Now());
	writeDump(Session.dtTest);
	writeDump(Session.dtTest2);
	writeDump(Server.Lucee);
</cfscript>

Run the script and on the first run the dtTest2 is {ts ‘2017-03-29 19:00:00’}, on the second run it is {ts ‘2017-03-29 14:00:00’}… this continues to count down until {ts ‘2017-03-26 00:00:00’}.

If you change the sessionStorage to memory, then the process runs as it should, always displaying {ts ‘2017-03-29 19:00:00’}

In the database the session is stored as

struct: {
	"DTTEST2": createDateTime(2017, 3, 29, 19, 0, 0, 0, "BST"),
	"timecreated": createDateTime(2017, 3, 25, 16, 25, 31, 304, "GMT"),
	"DTTEST": createDateTime(2017, 3, 25, 16, 45, 26, 535, "GMT"),
	"sessionid": "timezonetesting_5d88ee9e-c336-4a5f-87e0-2f2071036fc2_0",
	"lastvisit": createDateTime(2017, 3, 25, 16, 45, 31, 354, "GMT")
}

I’m guessing that the BST is causing some internal conversion?

Anyone have any ideas how to fix this?

For the moment, we’ve rolled back the version of lucee to 4.5.2.018 which doesn’t have this problem, as my initial testing shows this problem present in 5.1.2.024, 5.1.1.065 and 5.1.0.034.

Kind regards

Jedi

1 Like