Heads-up for anyone monitoring Lucee datasource pool health via getSystemMetrics(). A bug in how the function keyed its datasourceConnections entries has been fixed in 6.2.7.12, 7.0.4.28, and 7.1.0.109 — and the fix is breaking for a small number of consumers. Worth a quick read if you scrape this metric.
What was wrong
getSystemMetrics().datasourceConnections returned a struct keyed by
datasource.hashCode(). When two pools wrapped the same DataSource
object — possible whenever a cfquery uses credentials that differ from the datasource’s own — the entries collided and silently overwrote each other. Operators saw fewer pool entries and inaccurate per-entry counts than the system actually had.
The same loop also had a typo (idle += getNumWaiters() where it should have been waiters += ...) which made the top-level waitingForConn total always zero and double-counted waiters into idleDatasourceConnections.
Concrete example
Suppose mydb is queried both bare (uses datasource’s own creds) and
with an explicit read-only user:
queryExecute( "select 1", {}, { datasource: "mydb" } );
queryExecute( "select 1", {}, { datasource: "mydb", username: "readonly", password: "secret" } );
Before — both pools collide on datasource.hashCode(), one
overwrites the other:
datasourceConnections: {
"1234567890": {
name: "mydb",
idleDatasourceConnections: 1, // only one pool's data, the other is gone
...
}
}
After — distinct entries, with username exposed:
datasourceConnections: {
"mydb:sa:499602d2": {
name: "mydb",
username: "sa",
idleDatasourceConnections: 1,
...
},
"mydb:readonly:499602d2": {
name: "mydb",
username: "readonly",
idleDatasourceConnections: 1,
...
}
}
What changes
Breaking
-
Entry keys are now strings, not integers. Format is
name:user:hashHex, e.g."mydb:sa:499602d2"(was"1234567890").
Code that parses keys as integers —val(key),int(key)— now
gets0. Code that iterates withfor k in structand looks up
entries by the innernamefield continues to work unchanged. -
Top-level totals shift.
waitingForConnnow reports actual waiter count (was always 0).idleDatasourceConnectionsnow reports only idle connections (no longer includes waiters). Anything trending these values will see a one-time step. -
More entries visible. Pools that previously collided now appear as distinct entries.
structCount(datasourceConnections)may return more than before for any datasource with multiple credential variations.
Additive (non-breaking)
- Each entry now exposes a
usernamefield. Dashboards can filter by user without parsing the key.
Migration
- If you parse keys as numbers anywhere — switch to iterating and using
the innername/usernamefields. - If you alert on
waitingForConn == 0as a healthy state — re-tune the
threshold; the metric is now meaningful. - If you compare
idleDatasourceConnectionsagainst historical values —
expect a step change downward.
Versions
| Branch | Version |
|---|---|
| 6.2 LTS | 6.2.7.12-SNAPSHOT |
| 7.0 stable | 7.0.4.28-SNAPSHOT |
| 7.1 dev | 7.1.0.109-SNAPSHOT |
Links
Questions or feedback welcome on the ticket or here.