[go: up one dir, main page]

Skip to content

Extend EOF Error Handling to All Client-Side Streamers

Background

In merge request !7137 (merged), we implemented proper error handling for some of the client-side streamers that use the Chunker pattern. When a client receives an io.EOF error during a Send() operation, it now calls Recv() on the stream to retrieve the actual error status instead of returning the opaque EOF error.

However, this fix was only applied to specific client-side streamers that use the Chunker pattern. We need to extend this pattern to all other client-side streamers to ensure consistent error handling throughout the codebase.

Problem

When using gRPC streaming, the client may receive an io.EOF error that doesn't provide the actual error details. As documented in the gRPC API:

On error, SendMsg aborts the stream. If the error was generated by the client, the status is returned directly; otherwise, io.EOF is returned and the status of the stream may be discovered using Recv.

Currently, many client-side streamers don't follow this pattern and simply return the io.EOF error without calling Recv() to get the actual error status, resulting in:

  1. Opaque error messages that don't provide useful information
  2. Difficulty in debugging server-side issues
  3. Inconsistent error handling across the codebase

Proposed Solution

  1. Identify all client-side streamers with or without Chunker pattern, which are not handling io.EOF yet.
  2. Modify each streamer to properly handle io.EOF errors by calling Recv() to get the actual error status
  3. Ensure consistent error message formatting across all streamers

Implementation Details

For each client-side streamer, implement error handling similar to what was done in !7137 (merged):

// Example implementation pattern




err := stream.Send(&request)
if err != nil {
    if errors.Is(err, io.EOF) {
        if _, recvErr := stream.Recv(); recvErr != nil {
            return recvErr
        }
    }
    return err
}

Files to Modify

Identify all client-side streamers in:

  • internal/ directory
  • Any package that makes gRPC streaming calls

Testing

  1. Add unit tests that simulate server-side errors during streaming
  2. Verify that the actual error message is propagated to the client
  3. Ensure error messages are consistent and informative
Edited by Mustafa Bayar
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information