Hi team!
We’ve spotted a small timezone inconsistency when running queries inside parallel array iterations ( ArrayEach / .each( callback, true, n )).
While getTimeZone() inside a worker thread correctly returns the request timezone, any JDBC connection checked out on that same worker misses the override and stays on the pool/driver default timezone.
Environment
- Lucee:
7.0.5-SNAPSHOT+41 - Java: OpenJDK 21
- DB: PostgreSQL 18 (
pgjdbcdriver) - Engine / OS: CommandBox (Runwar / Undertow) / Ubuntu Linux
Quick repro
<cfscript>
setTimeZone( "America/New_York" );
function sessionTZ() {
return QueryExecute( "SHOW timezone", {}, { datasource = "yourDsn" } ).timezone;
}
echo( "getTimeZone() main: " & getTimeZone() & "<br>" ); // America/New_York
echo( "DB session main: " & sessionTZ() & "<br>" ); // America/New_York
var variables.seenTZ = [ 1, 2, 3, 4 ].map( function( i ) { return getTimeZone(); }, true, 4 );
var variables.seenDB = [ 1, 2, 3, 4 ].map( function( i ) { return sessionTZ(); }, true, 4 );
echo( "getTimeZone() workers: " & ArrayToList( variables.seenTZ ) & "<br>" ); // America/New_York x4 (OK)
echo( "DB session workers: " & ArrayToList( variables.seenDB ) & "<br>" ); // Europe/Rome x4 (BUG)
</cfscript>
Summary
| Context | getTimeZone() |
DB session (SHOW timezone) |
|---|---|---|
| Main thread | Request TZ | Request TZ |
| Parallel worker | Request TZ | Pool/driver default |
Impact
- Connection crashes: On PostgreSQL ≥ 16, if the JVM default is an abbreviation like
CET,pgjdbcfails at startup withFATAL: invalid value for parameter "TimeZone": "CET". The main thread bypasses this thanks tothis.timezone, but fresh connections opened by workers crash. - Data drift:
timestamp/timestamptzvalues read or written in parallel run under a different timezone than the rest of the request.
I was wondering if the Lucee team couldn’t automatically apply the PageContext timezone on connection checkout regardless of the thread, given that getTimeZone() already returns the correct value inside the worker?
Happy to share full stack traces or a test repo if needed.
Thanks for all your work on Lucee 7!
Best,
Roberto