phacility/phabricator · warning · Exception

Client closed connection before receiving response.

Error message

Client closed connection before receiving response.

What it means

The mirrored case: the IO channel reports the peer is no longer open for writing from the server's perspective - the client disconnected before receiving the server's response. The workflow kills the subprocess and aborts instead of writing to a dead socket.

Source

Thrown at src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php:135

          $uri = $struct[2]['value'];
          $path = $this->getPathFromSubversionURI($uri);

          return $this->loadRepositoryWithPath(
            $path,
            PhabricatorRepositoryType::REPOSITORY_TYPE_SVN);
        }
      }

      if (!$io_channel->isOpenForReading()) {
        throw new Exception(
          pht(
            'Client closed connection before sending a complete protocol '.
            'frame.'));
      }

      // If the client has disconnected, kill the subprocess and bail.
      if (!$io_channel->isOpenForWriting()) {
        throw new Exception(
          pht(
            'Client closed connection before receiving response.'));
      }
    }
  }

  protected function executeRepositoryOperations() {
    $repository = $this->getRepository();

    $args = $this->getArgs();
    if (!$args->getArg('tunnel')) {
      throw new Exception(pht('Expected `%s`!', 'svnserve -t'));
    }

    if ($this->shouldProxy()) {
      // NOTE: We're always requesting a writable device here. The request
      // might be read-only, but we can't currently tell, and SVN requests
      // can mix reads and writes.

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Retry the operation; if it recurs for one client only, inspect that client's network path
  2. Raise SSH keep-alives (ServerAliveInterval on the client) so stateful middleboxes keep the session alive
  3. For huge working copies, use sparse checkouts or chunked exports to shorten session lifetime
Defensive patterns

Strategy: try-catch

Try / catch

try {
  $workflow->execute($args);
} catch (Exception $ex) {
  // Peer went away mid-response: kill the subprocess and release the
  // repository write lock so the next session is not blocked.
  $future->resolveKill();
  return 1;
}

Prevention

When it happens

Trigger: Client disconnects while svnserve computes or streams a response: killed checkout, closed laptop, proxy idle-timeout cutting the SSH session.

Common situations: Long checkouts dropped by NAT/firewall idle timers; CI cancellation mid-operation; VPN/mobile users dropping during large transfers.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/db30720ecd5d5ba9. Report an issue: GitHub.