Skip to content

[Bug]: GetWALTruncate waits 8–16 seconds on a blackholed connection despite healthy LogService voters #32934

Open

Description

@jiangxinmeng1

Problem

GetWALTruncate, a read-only call used by the single-TN WAL replayer and truncate recovery, waits for a blackholed established connection to fail and returns an error even while the Log shard has a healthy three-voter quorum and the client knows working addresses. The TN driver retries after that error, so this adds an avoidable delay to replay/truncation recovery. In the controlled test the first call waited 8 or 16 seconds; this is not a claim that all deployments see the same latency.

Reproduction

TestAuditThreeVoterGetWALTruncateStallsOnBlackholedPeer starts a real three-voter Log shard with one TN ID:

  1. Connect a LogService client through a TCP proxy to the current leader and complete GetWALTruncate once.
  2. Make the proxy keep forwarding requests but drop responses on this established connection. Configure that same managed client with the three real service addresses for reconnection.
  3. Start GetWALTruncate on the affected client. While it waits, a separate client reads the same waterline through a direct, healthy address in under 2 seconds.
  4. The affected call returns an I/O timeout after 8 or 16 seconds, rather than succeeding via another address. Its next call reconnects and succeeds.

Two ordinary three-voter runs waited 8.002 and 8.001 seconds. Two race runs waited 8.003 and 16.002 seconds. A single-service control reproduced the same behavior at 8.002 and 16.001 seconds. No real network packet loss or TN process was used; the proxy fixes the response-loss timing while all Raft voters remain alive.

Code path

pkg/logservice/client.go: managedClient.GetWALTruncate makes one c.client.getWALTruncate(ctx) attempt, resets the connection on error, and returns immediately. The backend read timeout is 8 seconds; depending on the connection's idle/read phase, the call can consume two such windows. Read and GetTruncatedLsn in the same client already use bounded per-address attempts and retry safe reads after timeouts. pkg/vm/engine/tae/logstore/driver/logservicedriver/truncate.go:getWALTruncateFromBackend retries this operation, but only after the stalled attempt returns. The replayer calls this method during replay startup (replayer.go) and when reconciling a missing WAL position.

Expected behavior

Treat this read-only waterline query like the other safe LogService reads: bound one established-address attempt, reset it, and try another known replica while the caller's context is live. Preserve the returned PSN/DSN pair and the caller's overall deadline.

Related work

#32148 tracked the old 60-second Read long tail and is closed after Read gained a bounded retry. This issue concerns the still-unbounded-by-read-attempt GetWALTruncate path on current main. It does not claim WAL loss or incorrect truncation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions