Cannot connect gRPC

1. The problem I’m having:

(I’m sorry in advance because it’s a translator before the question)

I’m trying to use this library
https://github.com/naver/scavenger

To briefly explain the structure of this library, there are three services, Collector, Api, and Agent, and the Collector and Agent exchange data with gRPC

I built Collector and Api on an in-house server and generated records that connect to the two services through AWS Route 53.
And I want to make a request consisting of that record to be delivered to each service through Caddy when it comes into the server.

There was a problem with the part where the Agent and Collector exchanged data, but after looking it up, it seems that the proxy server sent HTTP1.1 rather than HTTP2, so the Agent is not interpreting the response (I will attach the log later).

I found out from the questions related to gRPC currently written in the community that Caddy supports HTTP2, but it was hard to figure out what the problem was, so I wrote the question.

Oh, for your information, if I run the service directly locally and not through Route53 and Caddy, it works normally.

2. Error messages and/or full log output:

Collector Log
I will not attach the Collector log because there is only the INFO log that the request was received and the initial setup log

Agent Log

9월 18, 2023 2:58:33 오후 com.navercorp.scavenger.javaagent.collecting.CodeBaseScanner scan
INFO: [scavenger] codebase(22a82ecc1ca8f16a0c2b0245c9bff51d2b2f891894279259823fa876c0de760f) scanned in 1978 ms: 9293 methods
2023-09-18 14:58:38.502  INFO 14576 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Initializing ExecutorService

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v2.3.12.RELEASE)
....................
Some Spring Boot Initial Logs.....
....................
2023-09-18 14:58:43.894  INFO 14576 --- [enger scheduler] c.n.s.javaagent.publishing.Publisher     : [scavenger] polling dynamic config
2023-09-18 14:58:43.896  INFO 14576 --- [enger scheduler] c.n.s.javaagent.publishing.Publisher     : [scavenger] trying to resolve collector url by accessing https://staging-scavenger-collector.help-me.kr/javaagent/v5/initConfig
2023-09-18 14:58:44.071  INFO 14576 --- [enger scheduler] c.n.s.javaagent.publishing.Publisher     : [scavenger] resolved collector url is staging-scavenger-collector.help-me.kr
2023-09-18 14:58:44.072  INFO 14576 --- [enger scheduler] c.n.s.javaagent.publishing.GrpcClient    : [scavenger] creating new grpc client. host is staging-scavenger-collector.help-me.kr
2023-09-18 14:58:44.205 ERROR 14576 --- [enger scheduler] c.n.s.javaagent.scheduling.Scheduler     : [scavenger] poll config failed

sc.io.grpc.StatusRuntimeException: INTERNAL: error in frame handler
        at sc.io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:271) ~[scavenger-agent.jar:1.1.1]
        at sc.io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:252) ~[scavenger-agent.jar:1.1.1]
        at sc.io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:165) ~[scavenger-agent.jar:1.1.1]
        at sc.com.navercorp.scavenger.model.GrpcAgentServiceGrpc$GrpcAgentServiceBlockingStub.pollConfig(GrpcAgentServiceGrpc.java:263) ~[scavenger-agent.jar:1.1.1]
        at com.navercorp.scavenger.javaagent.publishing.GrpcClient.pollConfig(GrpcClient.java:44) ~[scavenger-agent.jar:1.1.1]
        at com.navercorp.scavenger.javaagent.publishing.Publisher.pollDynamicConfig(Publisher.java:99) ~[scavenger-agent.jar:1.1.1]
        at com.navercorp.scavenger.javaagent.scheduling.Scheduler.pollDynamicConfigIfNeeded(Scheduler.java:126) ~[scavenger-agent.jar:1.1.1]
        at com.navercorp.scavenger.javaagent.scheduling.Scheduler.run(Scheduler.java:114) ~[scavenger-agent.jar:1.1.1]
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na]
        at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[na:na]
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
        at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: java.io.IOException: FRAME_SIZE_ERROR: 4740180
        at sc.io.grpc.okhttp.internal.framed.Http2.ioException(Http2.java:597) ~[scavenger-agent.jar:1.1.1]
        at sc.io.grpc.okhttp.internal.framed.Http2.access$200(Http2.java:48) ~[scavenger-agent.jar:1.1.1]
        at sc.io.grpc.okhttp.internal.framed.Http2$Reader.nextFrame(Http2.java:138) ~[scavenger-agent.jar:1.1.1]
        at sc.io.grpc.okhttp.OkHttpClientTransport$ClientFrameHandler.run(OkHttpClientTransport.java:1083) ~[scavenger-agent.jar:1.1.1]
        ... 3 common frames omitted

[scavenger] shutting down...
2023-09-18 14:58:44.821  INFO 14576 --- [extShutdownHook] o.s.s.c.ThreadPoolTaskScheduler          : Shutting down ExecutorService
2023-09-18 14:58:45.358  INFO 14576 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2023-09-18 14:58:45.364  INFO 14576 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JDBC repositories in DEFAULT mode.
....................
Spring Server Started.......

3. Caddy version:

Go 1.19.9
Caddy 2.6.4 (Custom Build)

[Custom Build]

  1. git clone caddy
  2. go get GitHub - caddy-dns/route53: Caddy module: dns.providers.route53
  3. cd cmd/caddy
  4. add _ "github.com/caddy-dns/route53" in main.go file
  5. go build

4. How I installed and ran Caddy:

a. System environment:

Ubuntu Debian 20.04 LTS

b. Command:

/etc/systemd/system/caddy start --config /etc/caddy/Caddyfile

c. My complete Caddy config:

Caddyfile

import conf.d/*

conf.d/staging-scavenger.help-me.kr

staging-scavenger.help-me.kr {
  log {
    level INFO
    output file /var/log/caddy/staging.scavenger.access.log
  }

  reverse_proxy /* http://127.0.0.1:8081
}

staging-scavenger-collector.help-me.kr {
  log {
    level INFO
    output file /var/log/caddy/staging.scavenger.collector.access.log
  }

  reverse_proxy /* http://127.0.0.1:8080
}

5. Links to relevant resources:


If you need more information, please request it. I’ll give you as much information as I can!

See reverse_proxy (Caddyfile directive) — Caddy Documentation

You need to configure your upstream address with h2c:// to enable cleartext HTTP/2, as required by gRPC.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.