Skip to content

Helidon exceptions are not propagated up through PbjProtocolHandler to the application via onError #304

@mattp-swirldslabs

Description

@mattp-swirldslabs

Description

An exception thrown in io.helidon.common.buffers.ReadOnlyArrayData invokes the onError() method in PbjProtocolHandler but that method does not signal an error to the application layer via Flow.Subscriber<? super Bytes> incoming. This prevents the application layer from taking action and cleaning up, etc.

Steps to reproduce

  1. Put a breakpoint in the PbjProtocolHandler.onError() method on the running server:
    public void onError(@NonNull final Throwable throwable) {
    if (throwable instanceof final GrpcException grpcException) {
    new TrailerBuilder()
    .grpcStatus(grpcException.status())
    .statusMessage(grpcException.getMessage())
    .send();
    } else {
    LOGGER.log(ERROR, "Failed to send response", throwable);
    new TrailerBuilder().grpcStatus(GrpcStatus.INTERNAL).send();
    }
    close();
    }
  2. Force an exception and note that it's caught in the PbjProtocolHandler.onError() method.
  3. Observe that this method never calls incoming.onError() or an equivalent to notify the application layer there was a problem.

Additional context

This is an example of how grpc.io handles the same exception:
image

Hedera network

No response

Version

v0.9.9

Operating system

macOS

Metadata

Metadata

Labels

BugAn error that causes the feature to behave differently than what was expected based on design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions