Skip to content

[BUG] TcpStream::connect() has no timeout, causing CLI to hang indefinitely #114

@Cute0110

Description

@Cute0110

Project

vgrep

Description

The HTTP client uses TcpStream::connect() without setting a timeout, causing the CLI to hang indefinitely if the server is unresponsive.

Error Observation

When the vgrep server is unreachable, the CLI hangs with no feedback for the OS default timeout (often 2+ minutes on Linux).

Error Message

Debug Logs

System Information

Version: 0.1.0

## Operating System
  OS: Ubuntu 24.04.3 LTS
  Kernel: 6.8.0-79-generic
  Arch: x86_64

## Hardware
  CPU: AMD Ryzen 9 5950X 16-Core Processor (4 cores)
  RAM: 11 GB

## Build Environment
  Rust: rustc 1.92.0 (ded5c06cf 2025-12-08)
  Target: x86_64

Screenshots

No response

Steps to Reproduce

  1. Don't start the vgrep server
  2. Run a vgrep CLI command that requires the server
  3. Observe the CLI hangs with no feedback

Code in src/server/client.rs lines 70, 118, 161:

let mut stream = TcpStream::connect(host_port)
    .context("Failed to connect to vgrep server")?;

### Expected Behavior

Should set a reasonable connection timeout (e.g., 5 seconds).

### Actual Behavior

CLI hangs for the OS default TCP timeout with no feedback to the user.

### Additional Context

Poor user experience when server is not running. Issue appears at 3 locations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginvalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions