Skip to content

fix(grpc-mongo): per-call deadlines so paced NextToken doesn't time out#235

Open
slayerjain wants to merge 1 commit into
mainfrom
fix/grpc-mongo-per-call-deadline
Open

fix(grpc-mongo): per-call deadlines so paced NextToken doesn't time out#235
slayerjain wants to merge 1 commit into
mainfrom
fix/grpc-mongo-per-call-deadline

Conversation

@slayerjain

Copy link
Copy Markdown
Member

Problem

The grpc-mongo client wraps SeedTokens + 10 deliberately-paced NextToken calls in a single shared 20s absolute-deadline context. With ~1s of pacing between calls + the server's 500ms work + keploy's proxyless-capture warmup, the cumulative wall-clock approaches 20s on a loaded CI runner, so NextToken #9 sporadically fails:

NextToken #9: rpc error: code = DeadlineExceeded desc = context deadline exceeded
exit status 1

This is a flaky step in the keploy enterprise CI (grpc-linux/run-grpc-mongo): it passes in most runs, fails under contention.

Fix

Give each RPC its own bounded (10s) context. The inter-call pacing no longer eats into a later call's budget, so the run is deterministic. Assertions unchanged — still 11 captures, every token asserted — and a genuinely hung RPC still times out at the per-call deadline. Not a shortcut: the shared absolute deadline was the structural bug.

The enterprise CI clones samples-go main, so this needs merging for the fix to land in CI; the grpc-mongo flake class is then verified by repeated enterprise pipeline runs.

The client wrapped SeedTokens + 10 deliberately-paced NextToken calls in a
single shared 20s absolute-deadline context. With 1s of pacing between
calls plus the server's 500ms work plus keploy's proxyless-capture warmup,
the cumulative wall-clock approached 20s on a loaded CI runner, so
NextToken #9 sporadically failed with "rpc error: code = DeadlineExceeded"
and exited 1 (flaky grpc-mongo step in the enterprise CI).

Give each RPC its own bounded (10s) context. The inter-call pacing no
longer eats into a later call's budget, so the run is deterministic; the
assertions are unchanged (11 captures, every token asserted) and a
genuinely hung RPC still times out at the per-call deadline.

Signed-off-by: slayerjain <shubhamkjain@outlook.com>
Copilot AI review requested due to automatic review settings June 23, 2026 09:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants