Skip to content

fix(mongodb): Don't return empty status, and return partial results - #793

Merged
codyprime merged 2 commits into
zmap:masterfrom
codyprime:jcody/mongodb-buildinfo-write-status
Oct 22, 2026
Merged

codyprime merged 2 commits into
zmap:masterfrom
codyprime:jcody/mongodb-buildinfo-write-status

Conversation

@codyprime

Copy link
Copy Markdown
Member

The buildInfo write error path returned an empty ScanStatus and a nil result. An empty status is not a member of the ScanStatus enum, so library users that map statuses (e.g. to protobuf) fail to handle the result at all, and the isMaster/listDatabases results already gathered are discarded.

Match the buildInfo read error path just below it: derive the status from the error with TryGetScanStatus and return the partial result. This also restores the behavior from before the write error was checked, when a failed write surfaced through the subsequent read.

How to Test

I've only seen this on transient network failures, so a natural reproducer is not available

Notes & Caveats

Issue Tracking

The buildInfo write error path returned an empty ScanStatus and a nil
result. An empty status is not a member of the ScanStatus enum, so
library users that map statuses (e.g. to protobuf) fail to handle the
result at all, and the isMaster/listDatabases results already gathered
are discarded.

Match the buildInfo read error path just below it: derive the status
from the error with TryGetScanStatus and return the partial result.
This also restores the behavior from before the write error was
checked, when a failed write surfaced through the subsequent read.
A buildInfo reply that is not valid BSON discarded the whole result,
including the isMaster and listDatabases responses already gathered.
Return the partial result with SCAN_PROTOCOL_ERROR instead, clearing
any half-unmarshaled BuildInfo, matching the truncated-reply path just
above it.
@codyprime
codyprime force-pushed the jcody/mongodb-buildinfo-write-status branch from 4eb939d to 3955192 Compare October 22, 2026 16:05
@codyprime
codyprime merged commit 835aa53 into zmap:master Oct 22, 2026
36 checks passed
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