Skip to content

[scd] Fix missing transaction timeout in SCD datastore#1402

Open
ashishjsharda wants to merge 1 commit intointeruss:masterfrom
ashishjsharda:fix/scd-transaction-timeout
Open

[scd] Fix missing transaction timeout in SCD datastore#1402
ashishjsharda wants to merge 1 commit intointeruss:masterfrom
ashishjsharda:fix/scd-transaction-timeout

Conversation

@ashishjsharda
Copy link
Contributor

Fixes #1393

Problem
The SCD Transact() method passed the context to CockroachDB with no deadline, so database transactions had no timeout. When a proxy timed out and dropped the client connection, the DSS continued processing and committed state changes which is the behaviour observed with the PUT /dss/v1/operational_intent_references request that completed and transitioned state to "Activated" after the client already received a 503.

Fix
Apply context.WithTimeout(ctx, DefaultTimeout) in SCD's Transact() before executing the database transaction. This mirrors the existing pattern already used by both the RID and AUX datastores.

Known Limitation
DefaultTimeout is hardcoded to 10s in the store rather than being wired to the --server timeout flag. This matches current RID/AUX behaviour but is not ideal .the long-term fix is an HTTP middleware/interceptor that sets a context deadline based on the flag uniformly for all handlers, as noted in the existing TODO in pkg/rid/server/v1/subscription_handler.go.

Apply context.WithTimeout in SCD Transact() so database transactions
are bounded by DefaultTimeout (10s), preventing the DSS from continuing
to process requests after the HTTP layer has already timed out.

RID and AUX datastores already applied this pattern; SCD was missing it,
causing the observed behaviour in interuss#1393 where a PUT
/dss/v1/operational_intent_references request completed and committed
state changes even after the client received a 503 timeout.

Co-Authored-By: Ashish Sharda <ashishjsharda@users.noreply.github.com>
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.

DSS continues processing after timeout

1 participant