Compare commits

...

2 Commits

Author SHA1 Message Date
Andrea Cavalli
b7172db2f9 Use direct executor in client 2024-10-02 18:09:14 +02:00
Andrea Cavalli
60474f2a75 Fix errors not handled when closed 2024-10-02 18:09:08 +02:00
2 changed files with 14 additions and 8 deletions

View File

@ -65,6 +65,7 @@ public class GrpcConnection extends BaseConnection implements RocksDBAPI {
super(name); super(name);
var channelBuilder = ManagedChannelBuilder var channelBuilder = ManagedChannelBuilder
.forAddress(address.host(), address.port()) .forAddress(address.host(), address.port())
.directExecutor()
.usePlaintext(); .usePlaintext();
this.channel = channelBuilder.build(); this.channel = channelBuilder.build();
this.blockingStub = RocksDBServiceGrpc.newBlockingStub(channel); this.blockingStub = RocksDBServiceGrpc.newBlockingStub(channel);

View File

@ -772,6 +772,8 @@ public class GrpcServer extends Server {
if (ex instanceof CompletionException exx) { if (ex instanceof CompletionException exx) {
handleError(responseObserver, exx.getCause()); handleError(responseObserver, exx.getCause());
} else { } else {
var serverResponseObserver = ((ServerCallStreamObserver<?>) responseObserver);
if (!serverResponseObserver.isCancelled()) {
if (ex instanceof RocksDBException e) { if (ex instanceof RocksDBException e) {
responseObserver.onError(Status.INTERNAL responseObserver.onError(Status.INTERNAL
.withDescription(e.getLocalizedMessage()) .withDescription(e.getLocalizedMessage())
@ -782,6 +784,9 @@ public class GrpcServer extends Server {
.withCause(ex) .withCause(ex)
.asException()); .asException());
} }
} else {
LOG.error("Unexpected error", ex);
}
} }
} }
} }