Skip to content

fix(monitor-input): skip HELLO lines in the --monitor-input loader (closes #496) - #498

Merged
fcostaoliveira merged 6 commits into
masterfrom
fix/monitor-input-hang-master
Jun 29, 2026
Merged

fcostaoliveira merged 6 commits into
masterfrom
fix/monitor-input-hang-master

Conversation

@fcostaoliveira

@fcostaoliveira fcostaoliveira commented Jun 26, 2026 •

Copy link
Copy Markdown
Collaborator

Makes the Monitor-Input Fuzz nightly pass (failed every run for days).

Root cause

Replaying HELLO "<proto>" from --monitor-input switches the connection to RESP3; memtier's RESP2 reply parser then blocks forever on a reply it can't decode, and the in-flight read isn't bounded by --test-time, so the Monitor-Input Fuzz run wedges past the harness timeout (the latent hang #482). This is why the nightly failed every run.

Fix (loader-level, not corpus-scrubbing)

monitor_command_list::load_from_file now skips connection/protocol-negotiation commands (HELLO) so they can never be replayed as a workload — every other command in the file still runs. Reported as "N unreplayable line(s) skipped". The corpus keeps its HELLO line so the fuzzer exercises the skip path. (Merely deleting HELLO from the seed fixes nothing — a real MONITOR capture contains it and the fuzzer mutates toward it.)

Verified

A lone HELLO input now exits immediately (was a >12s wedge); the full 17_all_command_types seed loads 91/92 commands (1 unreplayable skipped) and runs clean. Full monitor-fuzz driver re-run for confirmation.

The deeper option (bound the in-flight read by --test-time so any wedging reply self-recovers) remains tracked as #482.

2.4 backport: #497.


Note

Medium Risk
Loader behavior changes which monitor lines are replayed (HELLO skipped); that is intentional for safety but could surprise users replaying full MONITOR captures. CI-only fuzz tuning is low risk.

Overview
Fixes Monitor-Input Fuzz nightly failures by stopping HELLO from being replayed as --monitor-input workload and tightening CI fuzz limits.

Loader (config_types.cpp): monitor_command_list::load_from_file now drops connection/protocol commands (currently HELLO) via is_unreplayable_monitor_command_type(). Replaying HELLO switches the client to RESP3 while memtier still parses RESP2, which can wedge reads past --test-time (#482). Other lines in the file still load; stderr reports malformed vs unreplayable skip counts.

Fuzz driver (fuzz_monitor_input.py): Adds FUZZ_MAX_BYTES (MAX_MUTATION_BYTES) as a post-mutation size cap so compounded grow mutators cannot exceed CI budgets (default 32 MiB locally; workflow sets 2 MiB).

Workflow (monitor-fuzz.yml): Sets FUZZ_MAX_BYTES=2097152, raises FUZZ_TIMEOUT 90→180s for slow-but-finite ASAN runs, and fixes failure artifact upload to include /tmp/mfuzz_* (actual repro prefix) in addition to the old glob.

Reviewed by Cursor Bugbot for commit 63f9f47. Bugbot is set up for automated code reviews on this repo. Configure here.

@jit-ci

jit-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

…oses #496)

The Monitor-Input Fuzz nightly hung (>90s) every run on a captured/fuzzed
`HELLO "3"` line: replaying HELLO switches the connection to RESP3, after
which memtier's RESP2 reply parser blocks forever on a reply it can't
decode, and the in-flight read isn't bounded by --test-time, so the run
wedges until the harness watchdog kills it (issue #482).

Fix it where it belongs -- the monitor-input loader -- rather than by
scrubbing HELLO out of the corpus (which fixes nothing: a real MONITOR
capture contains HELLO, and the fuzzer mutates toward it). load_from_file
now skips connection/protocol-negotiation commands (HELLO) so they can
never be replayed as a workload; every other command in the file still
runs. Reports the count as "N unreplayable line(s) skipped".

The corpus keeps its HELLO line so the fuzzer exercises the skip path.

Verified: a lone HELLO input now exits immediately (was a >12s wedge);
the full 17_all_command_types seed loads 91/92 commands (1 unreplayable
skipped) and runs clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@fcostaoliveira
fcostaoliveira force-pushed the fix/monitor-input-hang-master branch from 4cd8846 to 86b3cc5 Compare June 26, 2026 12:19
@fcostaoliveira fcostaoliveira changed the title fix(monitor-fuzz): drop HELLO "3" from 17_all_command_types seed (closes #496) fix(monitor-input): skip HELLO lines in the --monitor-input loader (closes #496) Jun 26, 2026
…ented build (#496)

The HELLO loader-skip fix removed the real wedge, but the Monitor-Input
Fuzz nightly still failed on master: an 8 MiB grow-mutated --monitor-input
payload exceeds the 90s per-run timeout under master's heavier ASAN+UBSan
build (read-preference, CPU tracking, Prometheus). It's finite-but-slow,
not a hang -- the identical input completes in <20s locally and the exact
CI PRNG stream did not wedge in 470 local replays. Raise the per-run
timeout to 180s so slow large payloads finish; true (infinite) hangs are
unaffected since any timeout still trips them.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2262f9d. Configure here.

Comment thread config_types.cpp
if (skipped_malformed > 0) {
fprintf(stderr, "Loaded %zu monitor commands from %zu total lines (%zu malformed line(s) skipped)\n",
commands.size(), total_lines, skipped_malformed);
if (skipped_malformed > 0 || skipped_unsafe > 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Empty load omits unreplayable count

Low Severity

When load_from_file rejects a monitor file because every parseable segment was skipped, the failure message never includes skipped_unsafe. A capture containing only HELLO lines therefore prints the generic “no commands found” text even though unreplayable lines were intentionally dropped, unlike the success-path log that reports unreplayable skips.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2262f9d. Configure here.

fcostaoliveira and others added 4 commits June 26, 2026 19:50
Even at FUZZ_TIMEOUT=180 the Monitor-Input Fuzz nightly still timed out on
master: a grow-mutated 8 MiB --monitor-input (seed 17_all_command_types)
takes >180s to load/replay under the heavier instrumented ASAN+UBSan build
on CI runners (the same input is <20s locally -- a >9x runner slowdown).
It's finite-but-slow, not a hang. Rather than keep raising the timeout,
cap FUZZ_GROW_MAX at 2 MiB so the worst-case grow payload processes in
~45s (4x margin under the 180s timeout). Large-input coverage is retained
by the 17 MiB / million-line synthetic seeds.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
)

GROW_MAX=2MiB did not actually bound payload size: mutate() applies up to
4 mutators, so several grows compound to ~8MiB regardless (the only true
bound was the hard 32MiB truncate). master's monitor-fuzz still timed out
at 180s on a ~8MiB input (~22s/MiB under the heavier ASAN+UBSan build on
CI; <20s locally) -- finite-but-slow, not a hang.

Make the post-mutation truncate cap env-configurable (FUZZ_MAX_BYTES,
default 32MiB) and set it to 2MiB in the nightly so the worst-case payload
processes in ~45s. Verified: max mutated size over 3000 mutations is now
exactly 2MiB. Large-input coverage retained via the synthetic seeds.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…nitor_*) (#496)

The driver saves repros via tempfile prefix mfuzz_ (/tmp/mfuzz_*.txt) but
the upload step globbed /tmp/fuzz_monitor_*, so on failure no reproducer
was ever uploaded -- which hampered diagnosing the master slowness here.
Cover both globs.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
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