Skip to content

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Jan 20, 2026

Description

This PR addresses an issue where the TCP client in vgrep would hang indefinitely if the server was unresponsive or the network was congested. It introduces connection, read, and write timeouts to ensure the client fails gracefully instead of blocking forever.

Changes

  • Added CONNECT_TIMEOUT (5s), READ_TIMEOUT (60s), and WRITE_TIMEOUT (60s) constants.
  • Updated Client::search, Client::embed_batch, and Client::health to use TcpStream::connect_timeout.
  • Configured read and write timeouts on the socket streams.

Validation

  • Verified that the client now times out correctly when connecting to a non-responsive server (simulated with nc -l).
  • Ran existing tests to ensure no regressions.

Fixes PlatformNetwork/bounty-challenge#98

This adds connection, read, and write timeouts to the vgrep client to prevent indefinite hanging when the server is unresponsive or network is congested.

Fixes PlatformNetwork/bounty-challenge#98
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.

[BUG] TCP Client Has No Read/Write Timeout

2 participants