Skip to content

sequencerd: set SEQ_WAIT_EXPOSE before sending expose; match integer keys with = not like - #485

Open
cfremling wants to merge 2 commits into
mainfrom
fix/sequencer-expose-bit-race
Open

cfremling wants to merge 2 commits into
mainfrom
fix/sequencer-expose-bit-race

Conversation

@cfremling

@cfremling cfremling commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator

trigger_exposure() set SEQ_WAIT_EXPOSE after camerad's reply to expose and the EXPOSING database write. The async listener clears that bit on the first PIXELCOUNT and disarms. With EXPTIME 0 readout starts immediately, so PIXELCOUNT can arrive before the set; the bit is then set with nothing left to clear it and sequence_start waits on it forever. The set now happens before the command is sent.

Example, 2026-09-08 UT, CAL_BIAS id 112442 (NEXP 7, EXPTIME 0):

sequencerd_20260909.log
23:34:23.064  trigger_exposure  sending expose command
23:34:23.654  target CAL_BIAS id 112442 state exposing
23:34:23.654  waiting for exposure            <- "done waiting for expose" never follows
camerad_20260909.log
23:34:23.389  do_expose  expose is done now!   <- reply
23:36:57.585  ngps_260909_0021.fits closed; ready for next exposure

Wait bits stayed EXPOSE READOUT. Every earlier bias in the logs cleared EXPOSE 28-45 ms after "waiting for exposure".

Second commit: TargetInfo matched the integer keys with like (OBSERVATION_ID like :obsid, SET_ID like :setid), which casts the column and defeats the primary key. EXPLAIN gives type=ALL, 93102 rows, for both the SELECT and the UPDATE in update_state, so the EXPOSING write above takes ~215 ms instead of ~1 ms; that is the whole race margin. Changed to = in the four conditions; EXPLAIN becomes const/range on PRIMARY, 1 row, with int or string binds. SET_NAME like and STATE like unchanged.

🤖 Generated with Claude Code

…reply

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

…n on every state update)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@cfremling cfremling changed the title sequencerd: set SEQ_WAIT_EXPOSE before sending expose, not after the reply sequencerd: set SEQ_WAIT_EXPOSE before sending expose; match integer keys with = not like Sep 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant