Skip to content

Blob receive: uncaughtException from read-timeout and write-after-end race during replication #195

Description

@kriszyp

Investigative. Two related errors during replication blob transfer, both surfacing as uncaughtException:

Error 1: Blob read timeout (receive side)

uncaughtException Error: Blob error: Error: File read timed out
    at WebSocket.<anonymous> (.../threadServer.js:23:9590)
    at Receiver._write (.../ws/lib/receiver.js:94:10)

Plus: Timeout waiting for blob stream to finish <id> for record unknown from [redacted-host]

Error 2: Write-after-end race on blob PassThrough

uncaughtException Error [ERR_STREAM_WRITE_AFTER_END]: write after end
    at PassThrough.Writable.end (node:internal/streams/writable:611:17)
    at WebSocket.<anonymous> (.../threadServer.js:23:9624)
    at Receiver._write (.../ws/lib/receiver.js:94:10)

The ERR_STREAM_WRITE_AFTER_END suggests the WS receiver is writing a blob chunk to a PassThrough stream that has already been .end()-ed — a race between stream teardown and WS message delivery.

Status

Both errors surface as uncaughtException via Receiver._write — same escaping-error class fixed in related commits. "Currently blocked because we have no known way to reproduce" (from original Jira description).

Relation to other work

  • HarperFast/harper-pro#158 — CORE-3047 (same uncaughtException blob-timeout class, from the sending side; filed as "verify on current builds")
  • Commits 22f8777 and a686a55 fixed related blob-save uncaughtExceptions in the receive path — verify if these also address the ERR_STREAM_WRITE_AFTER_END pattern or only the .catch() on save promises.

Acceptance criteria

  • ERR_STREAM_WRITE_AFTER_END on blob PassThrough is caught/guarded so it cannot reach uncaughtException.
  • Blob read timeout on the receiving end is handled gracefully (same as CORE-3047 sends side).
  • Repro recipe documented once found.

🤖 Filed by Claude on behalf of Kris.

Metadata

Metadata

Assignees

Labels

area:replicationReplication, cluster sync, peer connectionsbugSomething isn't workingfrom-jiraMigrated or originated from a Jira ticket

Type

No type

Fields

Priority

P1

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions