Skip to content

Timeout handling at the client side. #206

Description

@batiati

The problem

The VSR client handles request timeouts by retrying indefinitely through each node of the cluster until it finds one that can reply:

From vsr/client.zig

 fn on_request_timeout(self: *Self) void {
	 
          // Omitted ...
	 
	 // We assume the leader is down and round-robin through the cluster:
	 self.send_message_to_replica(
	 @intCast(u8, (self.view + self.request_timeout.attempts) % self.replica_count),
	 message,
	 );
	 }

In this approach, the client implementation does not offer the application semantics for "timed out request" or "disconnected client", resulting in potentially endless wait if the client loses connectivity or if the cluster itself goes down.

Since none of the ongoing requests ever finish in this condition, the C tb_client's exhausts its max concurrency limit quickly, causing the client to "hang" waiting for resources before submitting a new request.
Also, both the Java client and the Go client would block if close is called in this situation, as long it waits for all ongoing requests to end before closing.

Solution

First, I'd like to confirm if this is indeed an issue or if it was a design decision:

  1. Being it an issue, I suggest adding a new configuration for "the max number of times we should round-robin through the cluster" and after that, drop the message and callback the client with a new TimedOut error.

  2. Being a design choice, it makes sense since the client is part of the cluster and isn't supposed to drop and give up any message on purpose. In this case, we may implement a way to notify the application that the client is disconnected, exposing that a) the application can submit no more requests; and b) ongoing requests may or may not complete and must be checked by the application once the client reconnects.

(...)

Please, feel free to point out a better solution for this case, I'll be happy to send a PR addressing it.

Metadata

Metadata

Assignees

No one assigned

    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