Repository navigation
fix(lane): close WebIdHelper's observation lookups so they release DuckDB sessions - #60
Merged
1 commit merged intoNov 25, 2026
Merged
1 commit merged into
1 commit merged into
Conversation
…query slot An unclosed selectKeys() stream that reached the cold tier kept one of the node's two DuckDB sessions forever. Two empty WebID matches on an RS-350 lane were enough to block every historical query (alarm table: 'Events could not be loaded'). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eed1679
Collaborator
|
Thank you @mjd948 for tracking down this critical 2-session DuckDB pool leak!
|
mjd948
pushed a commit
to mjd948/osh-oakridge-modules
that referenced
this pull request
Nov 25, 2026
mjd948
added a commit
to mjd948/osh-oakridge-modules
that referenced
this pull request
Nov 25, 2026
ORNL squash-merged our session, RS-350, lane-recovery and WebID fixes (ORNL#54, ORNL#55, ORNL#56, ORNL#60) plus their own follow-ups (ORNL#61), so their side was taken in every conflict except two: - LaneSystem keeps our Mobile Detector design (the occupancy process member is reused across restarts and covers D5 walkers); ORNL's "detector already started" start-up is kept for a newly created process, for RS-350 and D5 alike. EML re-attach follows ORNL. - Rs350OccupancyProcessModule takes ORNL's version: its event-bus restart handler (where our orphan guard lived) is gone upstream. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
WebIdHelperfinds the stored observation for each WebID and occupancy event withstore.selectKeys(filter).findFirst().get()and never closes the stream.On the tiered PostGIS store, a query that reaches the cold (Parquet) tier holds a DuckDB admission
permit. The permit is released only by the stream's
onClose(OscarTieredObsStore/ParquetArchiveReader). The defaultduckDbMaximumConcurrentSessionsis 2, so two leakedlookups take every cold-tier session for good. From then on, every historical query fails after 30 s
with
DuckDB session capacity is busy for operation cold-query after 30 seconds. The viewer's alarmtable shows "Events could not be loaded", and the video-retention scan fails too. Only a restart
clears it.
Seen on a 24/7 3.11.11 site with one RS-350 lane. Two WebID events whose phenomenon-time lookup
matched nothing ("Empty filter intersection", a
NoSuchElementExceptionfromOptional.get())leaked the two sessions 70 minutes apart:
cold-query-<uuid>directory induckdb-tmp, and their timestamps match thetwo errors to the second;
AdmissionController.acquire.#56 (in 3.11.14) re-attaches
WebIdHelperwhen the RS-350 comes up late, so on more nodes thehelper is now running and able to leak.
Fix
Both lookups now use try-with-resources and
findFirst().orElse(null). When nothing matches, thehelper logs a warning with the phenomenon time and returns. Before, it logged an error with a
stack trace.
Verification
sensorhub-system-lanetests: 68 passed.cold-query-*directories remain, the alarmtable's query returns 200, a 7-day per-datastream query returns in 0.09 s, and WebID subscribes on
the RS-350 lane.
Not changed here (worth a look)
Other observation-store reads in this repo don't close their stream either, so they could leak the
same way when they reach the cold tier:
StatisticsOutput.getLatestObservationIdWithinScope/getLastObservationOccupancyDataRecorder(select(filter).collect(...))MessageHandler(latest occupancy key)DatabasePurger.getOccupancyWindowsByLaneTrainingSandboxManager(several)None of them leaked on the site above, possibly because a fully consumed cursor, or a
latest-result query, never holds a cold session. I kept this PR to the one confirmed leak. I can
follow up with the rest if you'd like them closed too.
🤖 Generated with Claude Code