quarkiverse / quarkus-authzed-client

An extension for connecting to authzed instances from Quarkus applications
https://docs.authzed.com/reference/api
Apache License 2.0
5 stars 8 forks source link

io.grpc.StatusRuntimeException during onClose #87

Open risesilentassasin opened 10 months ago

risesilentassasin commented 10 months ago

Hi,

I've got exception during using this library after got response from authzed. Here is my log

2023-08-10 10:33:58,242 INFO [io.qua.grp.run.GrpcServerRecorder] (Quarkus Main Thread) Registering gRPC reflection service 2023-08-10 10:33:58,299 INFO [io.qua.grp.run.GrpcServerRecorder] (Quarkus Main Thread) Starting new Vert.x gRPC server ... 2023-08-10 10:33:58,449 INFO [io.quarkus] (Quarkus Main Thread) authz-tutorial 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.2.3.Final) started in 5.960s. Listening on: http://localhost:8080 2023-08-10 10:33:58,453 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated. 2023-08-10 10:33:58,455 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [authzed-client, cdi, grpc-server, resteasy, smallrye-context-propagation, vertx] 2023-08-10 10:34:06,427 FINE [io.grp.net.Utils] (grpc-default-executor-0) Using custom allocator: forceHeapBuffer=false, defaultPreferDirect=true 2023-08-10 10:34:06,428 FINE [io.grp.net.Utils] (grpc-default-executor-0) Creating allocator, preferDirect=true 2023-08-10 10:34:06,431 FINE [io.grp.net.Utils] (grpc-default-executor-0) Using default maxOrder=3 2023-08-10 10:34:06,690 DEBUG [io.grp.net.NettyClientHandler] (grpc-nio-worker-ELG-2-2) [id: 0x8ed6a45e, L:/192.168.18.11:58222 - R:grpc.authzed.com/130.211.126.102:80] OUTBOUND SETTINGS: ack=false settings={ENABLE_PUSH=0, MAX_CONCURRENT_STREAMS=0, INITIAL_WINDOW_SIZE=1048576, MAX_HEADER_LIST_SIZE=8192} 2023-08-10 10:34:06,695 DEBUG [io.grp.net.NettyClientHandler] (grpc-nio-worker-ELG-2-2) [id: 0x8ed6a45e, L:/192.168.18.11:58222 - R:grpc.authzed.com/130.211.126.102:80] OUTBOUND WINDOW_UPDATE: streamId=0 windowSizeIncrement=983041 2023-08-10 10:34:06,932 DEBUG [io.grp.net.NettyClientHandler] (grpc-nio-worker-ELG-2-2) [id: 0x8ed6a45e, L:/192.168.18.11:58222 - R:grpc.authzed.com/130.211.126.102:80] INBOUND SETTINGS: ack=false settings={HEADER_TABLE_SIZE=4096, MAX_CONCURRENT_STREAMS=2147483647, INITIAL_WINDOW_SIZE=268435456, 0x8=0} 2023-08-10 10:34:06,935 DEBUG [io.grp.net.NettyClientHandler] (grpc-nio-worker-ELG-2-2) [id: 0x8ed6a45e, L:/192.168.18.11:58222 - R:grpc.authzed.com/130.211.126.102:80] OUTBOUND SETTINGS: ack=true 2023-08-10 10:34:06,938 DEBUG [io.grp.net.NettyClientHandler] (grpc-nio-worker-ELG-2-2) [id: 0x8ed6a45e, L:/192.168.18.11:58222 - R:grpc.authzed.com/130.211.126.102:80] INBOUND SETTINGS: ack=true 2023-08-10 10:34:06,942 DEBUG [io.grp.net.NettyClientHandler] (grpc-nio-worker-ELG-2-2) [id: 0x8ed6a45e, L:/192.168.18.11:58222 - R:grpc.authzed.com/130.211.126.102:80] INBOUND WINDOW_UPDATE: streamId=0 windowSizeIncrement=268369921 2023-08-10 10:34:06,978 DEBUG [io.grp.net.NettyClientHandler] (grpc-nio-worker-ELG-2-2) [id: 0x8ed6a45e, L:/192.168.18.11:58222 - R:grpc.authzed.com/130.211.126.102:80] OUTBOUND HEADERS: streamId=3 headers=GrpcHttp2OutboundHeaders[:authority: grpc.authzed.com, :path: /authzed.api.v1.PermissionsService/CheckPermission, :method: POST, :scheme: http, content-type: application/grpc, te: trailers, user-agent: grpc-java-netty/1.56.0, grpc-accept-encoding: gzip, authorization: Bearer tc_test_token_6b341746edd4c53873e43d6c8f76a4942352fa815ec152c367dcf6dba5155c6e1b2508d6c4b2a3481627186a421e23b42096871ca4bba6f42215f1e0756d4199] streamDependency=0 weight=16 exclusive=false padding=0 endStream=false 2023-08-10 10:34:06,996 DEBUG [io.grp.net.NettyClientHandler] (grpc-nio-worker-ELG-2-2) [id: 0x8ed6a45e, L:/192.168.18.11:58222 - R:grpc.authzed.com/130.211.126.102:80] OUTBOUND DATA: streamId=3 padding=0 endStream=true length=100 bytes=000000005f0a022001122b0a1f7269736574656b6e6f6c6f67695f7475746f7269616c2f646f63756d656e7412086669727374646f631a047265616422260a24... 2023-08-10 10:34:07,244 DEBUG [io.grp.net.NettyClientHandler] (grpc-nio-worker-ELG-2-2) [id: 0x8ed6a45e, L:/192.168.18.11:58222 - R:grpc.authzed.com/130.211.126.102:80] INBOUND HEADERS: streamId=3 headers=GrpcHttp2ResponseHeaders[:status: 200, location: https://grpc.authzed.com/authzed.api.v1.PermissionsService/CheckPermission, content-type: application/grpc, grpc-status: 2, date: Thu, 10 Aug 2023 03:34:08 GMT, server: envoy] padding=0 endStream=true 2023-08-10 10:34:07,256 ERROR [com.ris.tec.GreetingResource] (executor-thread-1) something goes wrong: io.grpc.StatusRuntimeException: UNKNOWN at io.grpc.Status.asRuntimeException(Status.java:539) at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:491) at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39) at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23) at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40) at io.quarkus.grpc.runtime.supports.IOThreadClientInterceptor$1$1.onClose(IOThreadClientInterceptor.java:72) at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39) at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23) at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40) at io.grpc.census.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:814) at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39) at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23) at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40) at io.grpc.census.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:494) at io.grpc.internal.DelayedClientCall$DelayedListener$3.run(DelayedClientCall.java:489) at io.grpc.internal.DelayedClientCall$DelayedListener.delayOrExecute(DelayedClientCall.java:453) at io.grpc.internal.DelayedClientCall$DelayedListener.onClose(DelayedClientCall.java:486) at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:567) at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:71) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:735) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:716) at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.lang.Thread.run(Thread.java:1589) 2023-08-10 10:35:07,231 DEBUG [io.grp.net.NettyClientHandler] (grpc-nio-worker-ELG-2-2) [id: 0x8ed6a45e, L:/192.168.18.11:58222 - R:grpc.authzed.com/130.211.126.102:80] INBOUND GO_AWAY: lastStreamId=2147483647 errorCode=0 length=0 bytes= 2023-08-10 10:35:12,230 DEBUG [io.grp.net.NettyClientHandler] (grpc-nio-worker-ELG-2-2) [id: 0x8ed6a45e, L:/192.168.18.11:58222 - R:grpc.authzed.com/130.211.126.102:80] INBOUND GO_AWAY: lastStreamId=3 errorCode=0 length=0 bytes= 2023-08-10 10:35:13,233 FINE [io.grp.net.NettyClientHandler] (grpc-nio-worker-ELG-2-2) Network channel is close

Here also what i did in my code.

Consistency full = Consistency.newBuilder().setFullyConsistent(true).build();
Uni<CheckPermissionResponse> checkPermissionResponse = authzedClient.v1().permissionService()
    .checkPermission(CheckPermissionRequest.newBuilder().setConsistency(full)
        .setSubject(Tuples.parseUser("my_tutorial/user:sarah"))
        .setResource(Tuples.parseObject("my_tutorial/document:firstdoc")).setPermission("read").build());

// Is Sarah in the set of users that can read the first document?
try {
  Permissionship permissionship = checkPermissionResponse.await().indefinitely().getPermissionship();
  return "Response: " + permissionship;
} catch (Exception e) {
  String message = "something goes wrong";
  log.error(message, e);
  return message;
}

is there anyone could help to explained what should i do to fix this runtime exception?