Repository navigation
fix(v3.11.14): integrate HLS reaper, case-insensitive sign-in, RS-350 recovery, and async occupancy hardening - #58
Merged
Conversation
BackgroundOutput/ForegroundOutput called updateSize()/setData() on the live DataRecord returned by getRecordDescription(), so the registered template's variable-size spectrum arrays grew to match live data. On an in-JVM module restart (stop -> start without re-init) the re-registration then compared that mutated structure against the stored one and failed with "Cannot update the record structure or encoding of a datastream if it already has observations" (see matching osh-core fix). Records are now built on a dataStruct.copy() per message, leaving the template pristine. Same treatment for AdjudicationControl.createResultData and its isotopes/filePaths arrays. (The original commit, 683a0e9 on the old fork, also interrupted the MessageHandler reader/notifier threads on stop. ORNL's staged requestStop/awaitSourceStopped/awaitAncillaryStopped now does that, so that half was dropped in the port.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OccupancyWrapper.addFFmpegSensor deduplicated its camera list with contains(), i.e. by object identity. A camera module restart hands LaneSystem's STATE_CHANGED handler a different object for the same physical camera, so the stale entry survived and the new one was added alongside it. The occupancy then issued one record command per entry a few milliseconds apart; both resolved to the same timestamped file name, the loser died on FileAlreadyExistsException, and BOTH contributed an empty path to the occupancy — an alarm with no video at all. Observed live 2026-08-12: every alarming occupancy after 18:11 UTC on the three lanes whose modules had restarted carried videoPathCount=2 with two empty paths, while the lane without a restart recorded normally. Deduplicate by camera UID instead, in both add and remove, and stop the outgoing wrapper in doInit so a re-init cannot orphan a live one. Verified on the running node: after forcing two camera restarts on one lane through the admin UI, the next alarm recorded a single non-empty path and a 1.5 MB clip; five alarms across four lanes over the following hour, zero FileAlreadyExistsException. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
MessageHandler.timeSinceLastMessage was declared, assigned 0 once when the
reader thread started, and returned raw from getTimeSinceLastMessage() —
three references, never re-stamped. The getter therefore returned 0 forever,
so RS350Sensor.heartbeat()'s `getTimeSinceLastMessage() < reconnectPeriod`
test was always true: the driver published connectionStatus{isConnected:true}
at 1 Hz no matter how long the detector had been silent, and the else branch
that calls checkConnection() -> connection.reconnect() was unreachable, so a
dropped socket was never retried.
Observed on an RS-350 backpack lane with its simulator stopped: every data
stream (location, status, foreground/background report, dailyFile) 22 minutes
stale while connectionStatus stayed ~1 s fresh and true.
Hold a timestamp instead, mirroring the Rapiscan MessageHandler this was
copied from: volatile (the heartbeat reads it from another thread), stamped
when a complete message comes off the wire, seeded before the reader starts
so a detector that never sends ages out from module start rather than the
epoch, and the getter returns the elapsed time. With the deployed 10 s
reconnectPeriod the module now reports isConnected:false after 10 s of
silence and retries the connection.
Note the Aspect driver's MessageHandler keeps the same-named field but
measures the interval between loop iterations rather than time since the last
message, so it has an analogous blind spot; left alone here as there is no
Aspect hardware to verify against.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fixes new users being unable to sign in with their QR invite or temporary password. The /sensorhub servlet context and the viewer's root file server both run BasicSessionAuthenticator, and Jetty only remembers a logged-in result on the request, not a response the authenticator wrote itself. Each /sensorhub/session call therefore ran twice: the row's QR invite minted a second invite that revoked the one shown (410 "invalid, expired, or already used"), and a password reset ran twice so the temporary password shown was dead. validateRequest now records a sent response on the request and returns SEND_CONTINUE when the same request comes back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A detector that dropped off stayed dark until someone restarted the module by hand. Two separate reasons, both fixed here. The reconnect never ran. checkConnection() gated on connection.isConnected(), but RobustConnection sets its `connected` flag once on the first successful connect and only clears it in cancel()/reconnect() — nothing clears it when the peer disappears — so the flag stayed true and the branch was dead. Trigger on data silence instead, which is the signal that actually means something (and is what the Rapiscan driver uses). Reconnecting alone would not have helped either. The reader thread exits the moment the socket reports EOF, its InputStream belongs to the dead socket, and a Java thread cannot be restarted — so a fresh socket had no reader attached. Rebuild the comm provider, the stream and the MessageHandler together, wiring the new handler to the same outputs via initMessageHandler(), extracted from doStart(). Deliberately not RobustConnection.reconnect(): it stops and starts the whole module and gives up after reconnectAttempts, so an outage longer than reconnectAttempts * reconnectPeriod (110 s as deployed) would leave the module in ERROR with no heartbeat left to retry — trading a dark lane for a dead one. Rebuilding in place keeps the module STARTED and lets the heartbeat retry indefinitely, paced at one attempt per reconnectPeriod. Verified against the live node by blocking the detector's TCP port: comms reported false within ~10 s, rebuild attempts logged and failed while blocked, and data resumed ~10 s after the port reopened with no operator action — including across an outage longer than the old give-up window. messageHandler and isRunning are now volatile (written from the heartbeat thread, read from others) and doStop() is synchronized against the rebuild so a teardown cannot interleave with a swap. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Usernames keep their case but sign-in no longer depends on it: form, Basic and the passkey hint resolve "mike" to the one account "Mike". Creating a user, singly or in bulk, whose name differs from an existing one only by case is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HlsStreamHandler.stopStream and FFMPEGSensorBase.beforeStop built their internal commands with CommandData.Builder().withCommandStream(BigId.NONE). The Builder validates that ID (OshAsserts.checkValidInternalID: must be > 0), so build() threw before anything was submitted: - the inactivity sweep threw on its first expiry, and scheduleAtFixedRate silently cancels a task on an uncaught exception, so idle HLS streams then muxed forever (the same failure fixed on the old fork in 2624aa4; ORNL's per-bucket handler map fixed the other half of that bug); - every camera module stop logged 'Error stopping video output' and neither closed the recording file nor ended the HLS stream. Use the CommandData(id, params) constructor, which exists for sending a command directly to a driver, and make the sweep exception-proof per stream. HlsStreamHandlerTest did not catch this because it registers null controls, for which stopStream is a no-op. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the 3.11 scratch stack a Rapiscan simulator that was down for 4 minutes never came back: the lane configures every RPM driver with 10 retries 10 s apart, RobustConnection then throws "Maximum number of connection attempts reached", and the module stays STOPPED with an error (or LOADED with an error when the device was down at boot). Nothing retried from there, so any outage longer than about two minutes (switch reboot, cable pull) took the lane's radiation data down until someone restarted the module by hand. RpmRecoverySupervisor runs per lane while the lane is started. Every 15 s it looks at the RPM member and, only if it is auto-start, carries an error, and sits in LOADED or STOPPED, re-runs init (if needed) and start. Failed rounds back off 30 s / 60 s / 2 min / 5 min. A member an operator stopped on purpose has no error and is left alone. The lane's existing STARTED handler re-wires occupancy once the member is up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The RPM recovery supervisor restarts a failed RPM member, and each attempt holds it in STARTING for the driver's whole connection loop (about 100 s). Application readiness reads a nested STARTING member as a start still in flight, so one detector that stayed unreachable kept the ready marker down and the whole node unhealthy; oscar.sh start/restart then failed. The supervisor now reports when it is recovering, LaneSystem exposes that through IAutoStartDispatchStatus.isMemberUnderRecovery, and readiness treats such a member as settled once the lane's own auto-start dispatch is complete. Found at the live cutover: the site's RS-350 simulator was down. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SensorSystem starts a lane's auto-start members once, right after the lane starts, and waits at
most 10 s for each to initialize. The RS-350 occupancy process (and the Kromek D5 one on mobile
detector lanes) is initialized only when its detector reaches STARTED, so a detector that is
offline at boot leaves it un-started ("Cannot start subsystem ... - Occupancy"). When the
detector comes up later (RpmRecoverySupervisor or an operator restart), LaneSystem initializes
the process again, which also resets a running process to INITIALIZED, but nothing starts it.
The lane then records no occupancies for that detector and application readiness stays
withdrawn, so the container reports unhealthy.
Seen in the field: a walker lane booted while its RS-350 was unreachable; 50 min later the
supervisor recovered the detector, the process stayed INITIALIZED for 100 min until a restart,
and the node was unhealthy for the whole time.
After that init, OccupancyProcessStarter now starts the process on the lane's executor, but only
once the lane's own auto-start pass is over (autoStartDispatchComplete), the process is
auto-start, and it is still INITIALIZED when the task runs.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tarts late
LaneSystem creates its occupancy helpers in afterStart, each bound to the occupancy producer:
WebIdHelper waits 5 s for it to reach STARTED, OcrHelper 10 s, and both give up at once when it
is in error (AbstractModule.waitForState rethrows the module's error), which is where a detector
that was offline at boot leaves an RPM. EmlAutoAdjudicationHelper silently skips subscribing
without a producer UID. None of them retried, so after RpmRecoverySupervisor (or an operator)
brought the detector back, an RS-350 lane ran without WebID analysis ("Failed to create
WebId/Occupancy subscription") and a portal lane without vehicle OCR ("OCR inactive on lane")
until the next node restart.
Each helper now reports whether it is attached (or still waiting), the helper construction moved
out of afterStart into attach* methods guarded by one lock, and when the occupancy producer
reaches STARTED after the lane's auto-start pass, LaneSystem re-creates only the helpers that
gave up, on the lane executor. EML is re-attached on portal lanes only: on RS-350/D5 lanes its
producer (the occupancy process) has no UID when the helper is created, so it never subscribes
there today, and re-attaching would newly enable it. A normal boot is unchanged: helpers that attached or are still
waiting are left alone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ct, and 1 Hz allocation - Unify #48 and #56 so Rs350OccupancyProcessModule removes its unclosed hub-wide ModuleRegistry wildcard subscription and spin-wait thread, while OccupancyProcessStarter awaits initAsync=true (INITIALIZING -> INITIALIZED) off the EventBus thread and LaneSystem.afterStart() triggers occupancy init/start when RS350Sensor reached STARTED early. - Update LaneSystem.emlReattachExpected() to check occupancyProducer UID readiness so RS-350 extended-occupancy Code 9998 auto-adjudication binds cleanly after async startup. - Reuse a pre-copied liveDataStruct across 1 Hz RS-350 BackgroundOutput and ForegroundOutput frames (avoiding per-tick SWE DataComponent tree cloning while keeping getRecordDescription() pristine) and guard RS350Sensor.reestablishConnection() with connectionSwapLock so blocking TCP tryConnect() never stalls doStop(). - Add AGENTS.md, CLAUDE.md, and .github/PULL_REQUEST_TEMPLATE.md codifying 50-lane storage, concurrency, and v3.12.0 MobileDetectorSystem architectural invariants, and scrub internal .local test hostnames. Co-authored-by: kalynstricklin <kalynstricklin@botts-inc.com>
mjd948
pushed a commit
to mjd948/oscar
that referenced
this pull request
Nov 25, 2026
- Integrate and scale-harden ORNL/osh-core#10 (8c7d82a07), ORNL/osh-oakridge-modules#58, ORNL/oscar-viewer#51 (37b8de8), and ORNL/oscar-video-guides#10 (e00a1de). - Add AGENTS.md, CLAUDE.md, .github/PULL_REQUEST_TEMPLATE.md, .agents/skills/ workspace skills, docs/ARCHITECTURAL_ROADMAP.md, and tools/sync-project-board.mjs documenting 50-lane architectural invariants, shared branch-maintainer workflow, and v3.12.0 feature blueprints.
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.
Summary
Integrates and hardens the
v3.11.14bugfix and recovery improvements across FFmpeg HLS streaming, basic-session authentication,LaneSystemoccupancy orchestration, and RS-350 TCP driver lifecycle:ORNL/osh-oakridge-modules#54,@mjd948): PreventsHlsStreamHandler's idle reaper from killing live HLS sessions whose viewers continuously fetch.tsmedia segments from Jetty's static handler without re-invoking/hls/live.m3u8viaexecuteCommand().ORNL/osh-oakridge-modules#55,@mjd948): Resolves password sign-in case-insensitively while preserving stored display casing inwhoami/ session state and refusing case-only username collisions on user creation and CSV bulk upload; scrubs.localtest hostnames to RFC 2606portal.example.test.RpmRecoverySupervisor, and Unified AsyncOccupancyProcessStarter(ORNL/osh-oakridge-modules#48by@kalynstricklin+ORNL/osh-oakridge-modules#56by@mjd948):ModuleRegistry.EVENT_GROUP_IDwildcard subscription and spin-wait thread fromRs350OccupancyProcessModule(#48) while preservingOccupancyProcessStarter(#56) and extending it to awaitinitAsync = true(INITIALIZING -> INITIALIZED) off the OSH EventBus thread.LaneSystem.afterStart()andemlReattachExpected()so lanes whereRS350SensorreachesSTARTEDearly still initialize/startRs350OccupancyProcessModuleand attachEmlAutoAdjudicationHelper(Code 9998) cleanly.dataStruct.copy()tree cloning inBackgroundOutputandForegroundOutput(using a pre-copiedliveDataStructinitialized once ininit()) and guardsRS350Sensor.reestablishConnection()withconnectionSwapLockso blocking TCPtryConnect()never stallsdoStop().AGENTS.md,CLAUDE.md, and.github/PULL_REQUEST_TEMPLATE.mddocumenting 50-lanePARQUET_PRIMARY, DuckDB concurrency, 1 Hz allocation, localization, andv3.12.0MobileDetectorSystemarchitectural invariants.Related Issues / Coordinated PRs
ORNL/osh-oakridge-modules#54,ORNL/osh-oakridge-modules#55, andORNL/osh-oakridge-modules#56(preserving exact contributor commits via--no-ff), plus unified fixes fromORNL/osh-oakridge-modules#48.ORNL/osh-core#10andORNL/oscar-viewerfix/v3.11.14-viewer-hardeningforOSCAR v3.11.14.