Hi all. We migrated our Cerbos systemd service to ...
# help
d
Hi all. We migrated our Cerbos systemd service to a new system and are trying to deploy a web application that makes use of this system. We haven't changed anything in the configuration of the cerbos system or our web application, but are now receiving a pretty weird error in our web application:
Copy code
Apr 16 10:38:28 system java[59202]: 10:38:28.472 [http-nio-8080-exec-5] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [/rc/api] threw exception [Request processing failed; nested exception is dev.cerbos.sdk.CerbosException: RPC exception [Status{code=INTERNAL, description=Panic! This is a bug!, cause=java.lang.NoSuchMethodError: io.grpc.internal.Http2ClientStreamTransportState: method 'void <init>(int, io.grpc.internal.StatsTraceContext, io.grpc.internal.TransportTracer)' not found
Does anyone have a clue what could be the reason we are receiving this error?
c
Hi. This is an issue with dependencies. Someone else had the same problem and this was the fix: https://cerboscommunity.slack.com/archives/C02A364JYMQ/p1712752530409819?thread_ts=1712744034.914529&amp;cid=C02A364JYMQ
d
Hi Charith thank you for your message. I already saw this one indeed, tried bumping the SDK version but receiving some more conflicts now. Probably need to make some adjustments to my code. Thanks!
c
Try fixing the gRPC version as well
implementation("io.grpc:grpc-core:1.63.0")
d
It seems to conflict with protobuff:
Copy code
Apr 16 11:07:11 system java[60478]: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'overboekingListener': Unsatisfied dependency expressed through field 'rekeningService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'rekeningService' defined in URL [jar:file:/opt/backend-1.0.jar!/BOOT-INF/classes!/nl/rc/service/RekeningService.class]: Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'overboekingProducer' defined in URL [jar:file:/opt/backend-1.0.jar!/BOOT-INF/classes!/nl/rc/kafka/OverboekingProducer.class]: Unexpected exception during bean creation; nested exception is java.lang.NoClassDefFoundError: com/google/protobuf/GeneratedMessageV3
Currently using
protobuf:protoc:3.21.0
c
I think some other dependency is pulling in a different version of protobuf or gRPC. What's the output of
./gradlew dependencies
?
d
dependencies
c
This is probably the cause:
Copy code
+--- mysql:mysql-connector-java:8.0.29
|    \--- com.google.protobuf:protobuf-java:3.19.4 -> 4.26.1
I think
mysql-connector-java
has been superseded by
mysql-connector-j
. You could try replacing that dependency with
implementation("com.mysql:mysql-connector-j:8.3.0")
to see if that helps. Otherwise, you might have to downgrade Cerbos to a previous version that uses the older protobuf dependency (0.10.0 or 0.9.0).
d
Great, will try that in a bit. When using cerbos-sdk-0.9.0 the application does start but then I receive the RPC exception bug error. So hopefully it gets mitigated by replacing the mysql dependency
Nevertheless, thanks again for your help Charith. I will update you
c
Cool. Let me know how it goes. Java dependencies are such a nightmare! 😞
d
Haha, tell me about it.. getting gray hairs
😄 1
So when I use an older version of the cerbos-sdk the application does start, but I still receive the above RPC exception error.. I changed the mysql dependency, which seems to work when using cerbos-sdk-0.9.0, but it does not resolve the error with protobuf and the newer cerbos sdk version. Probably because other depencies (that are in the application) conflict somehow.
c
This used to work, right? Did you recently update any dependencies in your project?
d
Yeah that's the weird part about this 😂 The only thing that changed is the system that runs the cerbos systemd service. The app that we deploy is the same, and all the steps in the pipeline are also the same.. So it's pretty weird. Cant seem to find any commits by one of my colleagues as well.
I restarted the service and now I seem to get another error:
Copy code
Apr 16 13:36:22 wilson java[61805]: 13:36:22.419 [http-nio-8080-exec-1] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [/rc/api] threw exception [Request processing failed; nested exception is dev.cerbos.sdk.CerbosException: RPC exception [Status{code=DEADLINE_EXCEEDED, description=CallOptions deadline exceeded after 0.823372857s. Name resolution delay 0.031060419 seconds. [closed=[], open=[[buffered_nanos=840849531, waiting_for_connection]]], cause=null}]] with root cause
Apr 16 13:36:22 wilson java[61805]: dev.cerbos.sdk.CerbosException: RPC exception [Status{code=DEADLINE_EXCEEDED, description=CallOptions deadline exceeded after 0.823372857s. Name resolution delay 0.031060419 seconds. [closed=[], open=[[buffered_nanos=840849531, waiting_for_connection]]], cause=null}]
Using the SDK 0.9.0 and grpc-core:1+
c
Could you try setting the grpc version to 1.61.0 as well. That's the version that 0.9.0 uses.
I assume you just switched Cerbos to run in a new server? Is it in the same region? Could there be any firewall rules or stale DNS entries that affect how the client connects to it?
d
Thats correct. It's the same region and firewalld shouldn't be a problem. Maybe DNS could affect the connection so I will dive into that. The application does start now with the sdk 0.9.0 and grpc 1.61.0 so I will let that be 👍
👍 1
So it's really irritating, but all of a sudden the application seems to work again
Don't know what fixed it. I was going through logs and all of a sudden I saw information pop up on the app
Only thing left now is that the app doesn't write to audit.log anymore 😂 seems to have it's own will
Ah but I see now that is a permission issue. So nothing special
c
I was just going to say that it could be a permission issue 😄
d
Thank you again Charith for your time 🙂
c
No problem. Glad it got sorted.