fix(client-cohttp-eio): don't block process exit on shutdown - #4
Open
dijkstracula wants to merge 2 commits into
Open
fix(client-cohttp-eio): don't block process exit on shutdown#4dijkstracula wants to merge 2 commits into
dijkstracula wants to merge 2 commits into
Conversation
dijkstracula
force-pushed
the
nathan/skip-otel-backoff-on-shutdown
branch
from
August 6, 2026 05:14
fc60ad9 to
050649e
Compare
dijkstracula
force-pushed
the
nathan/skip-otel-backoff-on-shutdown
branch
2 times, most recently
from
August 6, 2026 05:24
050649e to
1ecb66b
Compare
dijkstracula
force-pushed
the
nathan/skip-otel-backoff-on-shutdown
branch
2 times, most recently
from
August 6, 2026 05:31
d2bbc3a to
6e8e472
Compare
dijkstracula
force-pushed
the
nathan/skip-otel-backoff-on-shutdown
branch
from
August 6, 2026 16:30
6e8e472 to
0889e81
Compare
dijkstracula
force-pushed
the
nathan/skip-otel-backoff-on-shutdown
branch
2 times, most recently
from
August 6, 2026 17:15
142bbe3 to
ade04b2
Compare
On a traced run whose collector is slow or unreachable, process exit stalled for seconds. Two independent causes, both removed: 1. send_http slept 3s after a failed POST as a retry throttle. That sleep also ran during cleanup's forced flush, adding ~3s to every exit. Drop it: the batch machinery already paces sends, and the error report is gated to non-shutdown so a failed teardown export stays quiet. 2. The tick fiber was a plain awaited fiber, so the switch waited out its 0.5s inter-tick sleep at teardown. Fork it as a daemon so the switch cancels that sleep instead. cleanup force-flushes the final batch before the switch returns, so cancellation can at worst drop a tick already mid-send. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
dijkstracula
force-pushed
the
nathan/skip-otel-backoff-on-shutdown
branch
from
August 7, 2026 22:46
ade04b2 to
2da6919
Compare
The semgrep org only allows SHA-pinned actions, so the tag/branch pins (checkout@v4/@main, setup-ocaml@v3, install-nix-action@v30, actions-gh-pages@v3) failed every job at set-up. Pin each to a full commit SHA with the version in a trailing comment.
dijkstracula
force-pushed
the
nathan/skip-otel-backoff-on-shutdown
branch
from
August 10, 2026 16:18
090c28f to
7b1335c
Compare
malaverdiere
pushed a commit
to semgrep/semgrep
that referenced
this pull request
Sep 4, 2026
…prietary#6864) Bumps the `semgrep/ocaml-opentelemetry` pin `6cfa5f16` → `2da6919` to pull in the shutdown fix from **semgrep/ocaml-opentelemetry#4**. On a traced run (`--trace`) whose collector is slow or unreachable, the cohttp-eio exporter blocked process exit for several seconds. The fork fix removes both causes: 1. drops `send_http`'s 3s failed-POST backoff (which also ran during `cleanup`'s forced flush), keeping the error report gated to non-shutdown; and 2. daemonizes the tick fiber so the switch cancels its 0.5s inter-tick sleep at teardown (`cleanup` force-flushes the final batch first, so no data loss beyond a tick already mid-send). Fragment-scanner traces: total exit time ~5.9s → ~3.2s, with `main_exn` unchanged (~1.8s) — the delta was pure shutdown tail. Pins the exporter-fix commit `2da6919`; the later CI-pinning commit on #4 is workflow-only and doesn't change the built package. Re-point to the `fork` merge commit once #4 lands. Needs the `opam` label so lockfile CI regenerates. Co-authored-by: ajbt200128 <austin@cutedogs.org> Co-authored-by: Katrina Liu <katrina@semgrep.com> Co-authored-by: Joshu Coats <joshua.coats@semgrep.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> synced from Pro 08ba4c961d5a9123bfb903efae0e29221f1e1386
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.
What
On a traced run (
--trace) whose OTel collector is slow or unreachable, processexit stalled for several seconds. This removes both causes.
Drop the 3s export backoff.
send_httpdidEio_unix.sleep 3.after afailed POST. Because
cleanup's forced flush also goes throughsend_http,that sleep ran at teardown and added ~3s to every exit. Removed; the batch
machinery (
batch_timeout, drain-on-pop) already paces retries, and theerror report is gated on
not (Atomic.get stop)so a failed shutdown exportstays quiet rather than spamming.
Daemonize the ticker. The 0.5s inter-tick
Eio.Time.sleepwas in a plainawaited fiber, so the switch waited it out at teardown (≤0.5s tail). It's now
a
fork_daemon, so the switch cancels the sleep at teardown. Safe becausecleanupforce-flushes the final batch before the switch returns.Evidence
Fragment-scanner APM traces:
Pro_core_CLI.main_exnis unchanged (~1.8s), whilethe total dropped from ~5.9s (3s-sleep) to ~3.2s (no-sleep) — the delta was pure
shutdown tail.
On a traced run (
--trace) when the OTel collector is slow or unreachable, the process exit took several seconds. The changes below fix both reasons.Remove the 3‑second export backoff.
send_httpused to callEio_unix.sleep 3.after a failed POST. Becausecleanupalso callssend_http, that sleep happened during teardown and added about 3 seconds to every exit. It has been removed. The batch system (batch_timeout, drain‑on‑pop) already controls retry timing, and the error report is only sent whennot (Atomic.get stop)so a failed shutdown export stays silent instead of spamming.Run the ticker as a daemon.
The 0.5‑second pause between ticks used to be in a normal awaited fiber, so the switch waited for it during teardown (up to 0.5 seconds). Now it is started with
fork_daemon, which lets the switch cancel the sleep at teardown. This is safe becausecleanupforce‑flushes the final batch before the switch returns.Evidence
Fragment‑scanner APM traces show that
Pro_core_CLI.main_exntime stayed about 1.8 seconds, while the total time dropped from roughly 5.9 seconds (with the 3‑second sleep) to about 3.2 seconds (without the sleep). The difference is just the shutdown tail.%