Code Monkey home page Code Monkey logo

grpc-spring's People

Contributors

a-simeshin avatar anjeyy avatar arnoldmashava avatar cfredri4 avatar dnvindhya avatar donbeave avatar dsyer avatar fengli79 avatar genuss avatar grekkor avatar internetstaff avatar jbf154 avatar kyle-a-wong avatar leobarykin avatar liqweed avatar luankevinferreira avatar marcindabrowski avatar nickufer avatar o-shevchenko avatar popfalushi avatar renovate-bot avatar renovate[bot] avatar rkettelerij avatar st-ddt avatar stanley-cheung avatar totorean avatar xieyucan avatar xjoewoo avatar yidongnan avatar zmrwego avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grpc-spring's Issues

memory leaking because sleuth span is not close

Tried to close span but it is not the current span: . You may have forgotten to close or detach.

I got many warn like above. And finally result in endless full GC.

image

image

image

image

seems tracer.close(span); did not close every spans correctly, inside TraceClientInterceptor.interceptCall().checkedStart().

After comment out all code which depends on sleuth, problem is fixed.

Looking forward to your reply.
Thanks

Client Side certificate authentication

Thanks for this Spring Boot integration!!

I've successfully configured it to use TLS tranport, but how would I use it for Client Side authentication in addition?

More specifically, something similar to the following:

Server server = NettyServerBuilder.forPort(8443)
    .sslContext(GrpcSslContexts.forServer(certChainFile, privateKeyFile)
        .trustManager(clientCertChainFile)
        .clientAuth(ClientAuth.REQUIRE) //this part
        .build());

https://github.com/grpc/grpc-java/blob/master/SECURITY.md#mutual-tls

Facing issue while running GRPC in embedded mode over TLS

I see similar issue posted (https://github.com/yidongnan/grpc-spring-boot-starter/pull/36) but do not see enough details how to use it -

I am trying to deploy my application [ GRPC + Spring Boot ] in Kubernetes infra.

I have set up a GRPC server with Spring boot on our pods - and as suggested I am running the processes on 2 different ports [ GRPC (port - 8443)+ Spring Boot (port- 8080) ] but my VIP is pointing to port 8443 right now.

I am able to configure SSL using .useTransportSecurity in a standalone grpc server (standalone here I mean without spring boot)

Problem: If my VIP is pointing to the GRPC server process on the pods I need to offload SSL in GRPC server but I do not see details how to do that if I am running my grpc server as an embedded server with spring boot.

Even if I deploy the application and when I try to connect using GRPC client I am seeing below error in servers and clinet is getting disconnected.

Where can I find additional application.properties specific to grpc ? I could only find grpc.server.port, grpc.server.host

2017-05-29 10:11:30.549 INFO 12796 --- [ main] n.d.s.a.grpc.server.GrpcServerLifecycle : gRPC Server started, listening on address: 0.0.0.0, port: 8443
2017-05-29 10:11:30.971 INFO 12796 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (https)
2017-05-29 10:11:30.979 INFO 12796 --- [ main] c.a.IntentProcessorGroup1Application : Started IntentProcessorGroup1Application in 26.45 seconds (JVM running for 27.737)
2017-05-29 10:11:41.736 WARN 12796 --- [-worker-ELG-3-1] io.grpc.netty.NettyServerHandler : Connection Error
io.netty.handler.codec.http2.Http2Exception: HTTP/2 client preface string missing or corrupt. Hex dump for received bytes: 160301008e0100008a03039bda7533eee4bee56f87bd4a42
at io.netty.handler.codec.http2.Http2Exception.connectionError(Http2Exception.java:85) ~[netty-codec-http2-4.1.8.Final.jar:4.1.8.Final]

The error above is in server side while I do see below error at client side -

E0531 07:51:58.291000000 10620 ssl_transport_security.c:937] Handshake failed with fatal error SSL_ERROR_SSL: error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER.
E0531 07:51:58.304000000 10620 ssl_transport_security.c:937] Handshake failed with fatal error SSL_ERROR_SSL: error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER.

eureka discovery

Hello @yidongnan , can you please confirm that cloud-discovery via Eureka is working?

I mean if i:

  • annotate my service with @GrpcClient("rpc-service"), and configure eureka-client
  • spring.application.name for rpc server is rpc-service, and it is registered properly on Eureka server

Then i do not need this part in application.yml:

grpc:
  client:
    rpc-service:
      host:
        - rpc-service.domain.tld
      port:
        - 1234

Is that correct assumption? If not - how exactly this spring-cloud & eureka integration supposed to work, what for?

Thanks in advance.

Best regards,
Nik

貌似项目demo跑不起来

@Autowired
private ConsulDiscoveryProperties properties;

@Autowired
private GrpcServerProperties grpcProperties;

@PostConstruct
public void init() {
    this.properties.getTags().add("grpc=" + grpcProperties.getPort());
}

为什么报错呢?

:examples:grpc-lib:extractIncludeProto[Fatal Error] spring-cloud-build-1.2.2.RELEASE.pom:882:6: 文档中根元素后面的标记必须格式正确。
[Fatal Error] spring-data-releasetrain-Hopper-SR5.pom:145:6: 不允许有匹配 "[xX][mM][lL]" 的处理指令目标。
[Fatal Error] spring-data-releasetrain-Hopper-SR5.pom:145:6: 不允许有匹配 "[xX][mM][lL]" 的处理指令目标。
[Fatal Error] spring-cloud-build-1.2.2.RELEASE.pom:882:6: 文档中根元素后面的标记必须格式正确。
[Fatal Error] spring-data-releasetrain-Hopper-SR5.pom:145:6: 不允许有匹配 "[xX][mM][lL]" 的处理指令目标。
[Fatal Error] spring-cloud-build-1.2.2.RELEASE.pom:882:6: 文档中根元素后面的标记必须格式正确。
[Fatal Error] spring-data-releasetrain-Hopper-SR5.pom:145:6: 不允许有匹配 "[xX][mM][lL]" 的处理指令目标。
[Fatal Error] spring-cloud-build-1.1.3.RELEASE.pom:852:1: 尾随节中不允许有内容。

Name resolution failed

io.grpc.StatusRuntimeException: UNAVAILABLE: Name resolution failed
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:230)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:211)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:144)
at com.ylifegroup.protobuf.PhoneServiceGrpc$PhoneServiceBlockingStub.addPhoneToUser(PhoneServiceGrpc.java:135)
at com.spring.cloud.es.service.GrpcClientService.addPhoneToUser(GrpcClientService.java:32)
at com.spring.cloud.es.controller.HelloController.grpcTest(HelloController.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:110)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: UNAVAILABLE: NameResolver returned an empty list
at net.devh.springboot.autoconfigure.grpc.client.DiscoveryClientNameResolver$1.run(DiscoveryClientNameResolver.java:131)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
... 1 more
spring-boot版本是1.5.9 并且服务端已经成功

2018-03-14 15:43:08.470 INFO 1640 --- [ restartedMain] n.d.s.a.g.server.NettyGrpcServerFactory : Registered gRPC service: PhoneService, bean: phoneServiceImpl, class: com.gkyt.ywgk.modular.service.grpc.PhoneServiceImpl
2018-03-14 15:43:09.981 INFO 1640 --- [ restartedMain] n.d.s.a.grpc.server.GrpcServerLifecycle : gRPC Server started, listening on address: 0.0.0.0, port: 9898

gRPC會有線程無上限問題

發現 gRPC 的 ThreadPool 行為對效能可能會有影響.

gRPC 預設使用 java.util.concurrent.Executors.newCachedThreadPool() 這個 ThreadPoolExecutor
但是這個 Executor 的行為有點危險.

在系統繁忙時. 如果目前 Executor 的 Thread 都已經在處理事情. 這個 Executor 會自動產生新的 Thread. 而且 "沒有上限".

所以譬如如果同時間有 1,000 個 gRPC request. 這個 Executor "最差" 有可能會產生 1,000 個 Thread.
上千個 Thread 對系統是蠻大的負擔. 因為預設64bit Linux每個Thread stack size 是 1,024K(1M). 1,000 個 thread 光 stack 就會吃掉 1G ram.

而且因為沒有上限. 所以隨 concurrent gRPC request 數量而增加.

比較適合的 Executor 模式會是 有個 thread # 上限. Executor 有限度的 暫存 進入的 request 數量. 避免同時也保護 Server 因為瞬間太多 request 而自爆.

目前 @GrpcService annoation. 會使用預設配置. 這個 ThreadPoolExecutor 沒辦法改. 而且沒辦法透過 設定修改,請問有解決辦法嗎?

空指针异常:java.lang.NullPointerException

java.lang.NullPointerException: null
at org.springframework.cloud.sleuth.util.ExceptionUtils.getExceptionMessage(ExceptionUtils.java:60)
at net.devh.springboot.autoconfigure.grpc.server.TraceServerInterceptor$1.close(TraceServerInterceptor.java:57)
at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:168)
at io.grpc.PartialForwardingServerCallListener.onHalfClose(PartialForwardingServerCallListener.java:33)
at io.grpc.ForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:23)
at io.grpc.ForwardingServerCallListener$SimpleForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:40)

Enabling SSL in GRPC setup on Springboot

I was struggling in enabling SSL in Grpc which is setup on Springboot. Finally I found and put following application properties.

gpc.server.security.enabled = true
gpc.server.security.certificate-chain-path: /home/user/SpringBootGrpc2/src/main/resources/Certificate.crt
gpc.server.security.certificate-path: /home/user/SpringBootGrpc2/src/main/resources/Private-key.key

I gave server certificate path to certificate-chain-path, and server private key file to certificate-path. Now seems SSL works fine, but I have a doubt on giving private key file to certificate-path.

Is this correct or if not what are the correct property names?

How to set Access-Control-Allow-Origin

grpc-spring-server <---> grpc-webproxy <---> grpc-web-client

Failed to load https://xxxService/Xxx: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://xxx' is therefore not allowed access. The response had HTTP status code 415. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

gRPC interceptors broken with latest Spring Boot and Cloud

Hi, first thanks for your work!
Trying to use the gRPC interceptors for zipkin's b3 headers propagation with Spring Boot 2.0.3.RELEASE and Cloud Finchley.RELEASE I found that the interceptors in https://github.com/yidongnan/grpc-spring-boot-starter/blob/4158756230680e10c55382cd9999c405efcefd28/grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/springboot/autoconfigure/grpc/client/TraceClientInterceptor.java#L30 are not compatible with Spring Cloud Sleuth. For example Tracer and SpanInjector are not in Sleuth 2.0.0 anymore.

Are you planning to update this with the latest versions of spring boot and cloud?

Thanks!

Add automated metric support

Spring has a module called actuator which allows metric collection.
If we would add support for that, we could check how many messages/requests/responses have been sent, how long it took, and check whether errors have occurred. Server owners could use these metrics and export them to prometheus and visualize them with Grafana or other tools.

grafana

Are you interested in adding that to this project?
(I might be able to contribute the necessary code for that as well)

Which test framework should we use?

I thought about adding a test project that can be used to automatically test all features of this library, to ensure there are no hidden breakages if new features are added or existing features changed.

Would you prefer JUnit 4.12 based tests or are you okay with the new JUnit 5 (JUpiter) tests?

(There isn't that much of a difference, but the new version uses a different package and is slightly more flexible due to using Java 8 features)

Include license text in the jar

First of all: I am not a lawyer, so I might be wrong.

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

The MIT license is a copy-left license, which states, that you have to include the license text when you distribute it. I'm not sure that also applies to your own jars, but I have seen many libraries that also include their own license text (junit for example).

Some include them in the /META-INF/ folder and some in the root folder. Others don't include them.

Also it would be nice if you could add a license section to the pom, so that mvnrepository.com can display that info on their page directly. (I can help you with that if you want)

Other references:

PS: Thanks for your awesome library.

现在是不支持Consul吗

本机测试ok 放到consul上报错 异常 自动去找grpc了 rest服务不可用

`
io.netty.handler.codec.http2.Http2Exception: Unexpected HTTP/1.x request: POST /v1/scores/manage/updateUserScore

at io.netty.handler.codec.http2.Http2Exception.connectionError(Http2Exception.java:85) ~[netty-codec-http2-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.readClientPrefaceString(Http2ConnectionHandler.java:314) ~[netty-codec-http2-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.decode(Http2ConnectionHandler.java:251) ~[netty-codec-http2-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:450) [netty-codec-http2-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489) [netty-codec-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428) [netty-codec-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265) [netty-codec-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [netty-transport-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434) [netty-transport-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [netty-transport-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [netty-transport-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965) [netty-transport-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [netty-transport-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645) [netty-transport-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580) [netty-transport-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497) [netty-transport-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459) [netty-transport-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) [netty-common-4.1.24.Final.jar!/:4.1.24.Final]


at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.24.Final.jar!/:4.1.24.Final]


at java.lang.Thread.run(Thread.java:748) [na:1.8.0_151]`

How to enable the ProtoReflectionService?

What is the correct way to add the ProtoReflectionService to the server?

Just adding the service to the GrpcServerFactory doesn't work because services added in that way don't get notified when the server is created and the ProtoReflectionService needs a reference to the server.

I got it working properly by extending the NettyGrpcServerFactory and creating my own GrpcServerFactory bean, but this seems pretty hacky.

@Configuration
public class GrpcConfig {

    @Bean
    public ProtoReflectionService protoReflectionService() {
        return (ProtoReflectionService) ProtoReflectionService.newInstance();
    }

    @Bean
    public NettyGrpcServerFactory grpcServiceFactory(GrpcServerProperties properties, GrpcServiceDiscoverer discoverer) {
        ProtoReflectionService reflectionServiceBean = protoReflectionService();

        NettyGrpcServerFactory factory = new ReflectionEnabledNettyGrpcServerFactory(properties, reflectionServiceBean);
        for (GrpcServiceDefinition service : discoverer.findGrpcServices()) {
            factory.addService(service);
        }

        GrpcServiceDefinition protoReflectionService =
                new GrpcServiceDefinition("protoReflectionService", ProtoReflectionService.class,
                        reflectionServiceBean.bindService());

        factory.addService(protoReflectionService);

        return factory;
    }

    private static class ReflectionEnabledNettyGrpcServerFactory extends NettyGrpcServerFactory {

        private final ProtoReflectionService protoReflectionService;

        ReflectionEnabledNettyGrpcServerFactory(GrpcServerProperties properties, ProtoReflectionService protoReflectionService) {
            super(properties);
            this.protoReflectionService = protoReflectionService;
        }

        @Override
        public Server createServer() {
            Server server = super.createServer();
            // Even though we added this service to the factory in the grpcServerFactory bean definition
            // we need to manually notify it when the server is built.
            //
            // Services added through the public addService method don't get notified when the server is built.
            // They aren't added as BindableServices to the builder. They are added to the InternalHandlerRegistry
            // instead. The protoReflectionService needs a reference to the server to work properly.
            protoReflectionService.notifyOnBuild(server);
            return server;
        }
    }
}

Add a way to register compressors/decompressors

NettyGrpcServerFactory.createServer should have a callback, so that a user is able to sneak in (de)compressorRegistry into the ServerBuilder instance.

Even better would be a mechanism similar to Interceptors (iterating beans, looking for an annotation like @GrpcCodec) and registering them as compressor/decompressor.

Currently the only way i see is providing a @primary NettyGrpcServerFactory that does the trick.
Am i missing something?

grpc-client-spring-boot-starter does not work with Spring Cloud Stream Sleuth

I found a problem that with Spring Cloud Stream and Sleuth, grpc-client-spring-boot-starter is not reporting spans to Kafka.

The problem is first described here: spring-cloud/spring-cloud-sleuth#719 , after which I narrowed down the root cause to grpc-client-spring-boot-starter. The issue is that with GrpcClientAutoConfiguration configuration in place, it requires Tracer bean to be instantiated early before MessagingAnnotationPostProcessor in Spring Integration get a chance to post-process it, causing following polling method is not collecting spans and reporting it to messaging queue:

// in org.springframework.cloud.sleuth.stream.StreamSpanReporter
	@InboundChannelAdapter(value = SleuthSource.OUTPUT, poller = @Poller(POLLER))
	public Spans poll() {
        ...
       }

In fact, it causes a number of beans being instantiated early. See following log printed by BeanPostProcessorChecker:

2017-10-01 20:20:58.745  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.kafka.annotation.KafkaBootstrapConfiguration' of type [org.springframework.kafka.annotation.KafkaBootstrapConfiguration$$EnhancerBySpringCGLIB$$a60515ef] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:58.789  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.instrument.async.AsyncDefaultAutoConfiguration$DefaultAsyncConfigurerSupport' of type [org.springframework.cloud.sleuth.instrument.async.AsyncDefaultAutoConfiguration$DefaultAsyncConfigurerSupport$$EnhancerBySpringCGLIB$$f94a22f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:58.948  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.annotation.SleuthAnnotationAutoConfiguration' of type [org.springframework.cloud.sleuth.annotation.SleuthAnnotationAutoConfiguration$$EnhancerBySpringCGLIB$$d4b84a9e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.365  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'sleuthAdvisorConfig' of type [org.springframework.cloud.sleuth.annotation.SleuthAdvisorConfig] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.374  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'net.devh.springboot.autoconfigure.grpc.client.GrpcClientAutoConfiguration' of type [net.devh.springboot.autoconfigure.grpc.client.GrpcClientAutoConfiguration$$EnhancerBySpringCGLIB$$e3d45cc0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.660  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.stream.config.SpelExpressionConverterConfiguration' of type [org.springframework.cloud.stream.config.SpelExpressionConverterConfiguration$$EnhancerBySpringCGLIB$$d28f5c61] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.681  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spelConverter' of type [org.springframework.cloud.stream.config.SpelExpressionConverterConfiguration$SpelConverter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.703  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'grpcChannelsProperties' of type [net.devh.springboot.autoconfigure.grpc.client.GrpcChannelsProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.716  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'grpcLoadBalancerFactory' of type [io.grpc.util.RoundRobinLoadBalancerFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.738  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'net.devh.springboot.autoconfigure.grpc.client.GrpcClientAutoConfiguration$TraceClientAutoConfiguration' of type [net.devh.springboot.autoconfigure.grpc.client.GrpcClientAutoConfiguration$TraceClientAutoConfiguration$$EnhancerBySpringCGLIB$$3a8c93dd] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.765  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.sleuth-org.springframework.cloud.sleuth.autoconfig.SleuthProperties' of type [org.springframework.cloud.sleuth.autoconfig.SleuthProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.770  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration' of type [org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration$$EnhancerBySpringCGLIB$$b50217f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.809  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'defaultSpanAdjuster' of type [org.springframework.cloud.sleuth.NoOpSpanAdjuster] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.812  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.stream.SleuthStreamAutoConfiguration' of type [org.springframework.cloud.sleuth.stream.SleuthStreamAutoConfiguration$$EnhancerBySpringCGLIB$$aca7b1fe] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.836  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.sleuth.sampler-org.springframework.cloud.sleuth.sampler.SamplerProperties' of type [org.springframework.cloud.sleuth.sampler.SamplerProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.845  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'defaultTraceSampler' of type [org.springframework.cloud.sleuth.sampler.PercentageBasedSampler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.854  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'randomForSpanIds' of type [java.util.Random] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.901  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spanNamer' of type [org.springframework.cloud.sleuth.DefaultSpanNamer] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.930  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.log.SleuthLogAutoConfiguration$Slf4jConfiguration' of type [org.springframework.cloud.sleuth.log.SleuthLogAutoConfiguration$Slf4jConfiguration$$EnhancerBySpringCGLIB$$58bb2b4d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:20:59.984  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.sleuth.log.slf4j-org.springframework.cloud.sleuth.log.SleuthSlf4jProperties' of type [org.springframework.cloud.sleuth.log.SleuthSlf4jProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.014  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'slf4jSpanLogger' of type [org.springframework.cloud.sleuth.log.Slf4jSpanLogger] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.050  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration' of type [org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration$$EnhancerBySpringCGLIB$$88a8803c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.098  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'serverProperties' of type [org.springframework.boot.autoconfigure.web.ServerProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.249  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.zipkin-org.springframework.cloud.sleuth.stream.ZipkinProperties' of type [org.springframework.cloud.sleuth.stream.ZipkinProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.267  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.commons.util.UtilAutoConfiguration' of type [org.springframework.cloud.commons.util.UtilAutoConfiguration$$EnhancerBySpringCGLIB$$9a00cdf0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.308  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'inetUtilsProperties' of type [org.springframework.cloud.commons.util.InetUtilsProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.321  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'inetUtils' of type [org.springframework.cloud.commons.util.InetUtils] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.329  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.stream.SleuthStreamAutoConfiguration$DefaultEndpointLocatorConfiguration' of type [org.springframework.cloud.sleuth.stream.SleuthStreamAutoConfiguration$DefaultEndpointLocatorConfiguration$$EnhancerBySpringCGLIB$$7f66c510] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.346  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'zipkinEndpointLocator' of type [org.springframework.cloud.sleuth.stream.ServerPropertiesHostLocator] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.355  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.metric.TraceMetricsAutoConfiguration$CounterServiceSpanReporterConfig' of type [org.springframework.cloud.sleuth.metric.TraceMetricsAutoConfiguration$CounterServiceSpanReporterConfig$$EnhancerBySpringCGLIB$$847edcbf] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.376  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.actuate.autoconfigure.MetricRepositoryAutoConfiguration$FastMetricServicesConfiguration' of type [org.springframework.boot.actuate.autoconfigure.MetricRepositoryAutoConfiguration$FastMetricServicesConfiguration$$EnhancerBySpringCGLIB$$b9b668bb] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.408  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'counterBuffers' of type [org.springframework.boot.actuate.metrics.buffer.CounterBuffers] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.429  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'counterService' of type [org.springframework.boot.actuate.metrics.buffer.BufferCounterService] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.438  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.metric.TraceMetricsAutoConfiguration' of type [org.springframework.cloud.sleuth.metric.TraceMetricsAutoConfiguration$$EnhancerBySpringCGLIB$$f8dd104d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.457  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'sleuthMetricProperties' of type [org.springframework.cloud.sleuth.metric.SleuthMetricProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.479  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spanReporterCounterService' of type [org.springframework.cloud.sleuth.metric.CounterServiceBasedSpanMetricReporter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.551  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'sleuthStreamSpanReporter' of type [org.springframework.cloud.sleuth.stream.StreamSpanReporter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.629  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.sleuth.keys-org.springframework.cloud.sleuth.TraceKeys' of type [org.springframework.cloud.sleuth.TraceKeys] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.658  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'sleuthTracer' of type [org.springframework.cloud.sleuth.trace.DefaultTracer] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.706  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'globalTraceClientInterceptorConfigurerAdapter' of type [net.devh.springboot.autoconfigure.grpc.client.GrpcClientAutoConfiguration$TraceClientAutoConfiguration$1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.723  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'globalClientInterceptorRegistry' of type [net.devh.springboot.autoconfigure.grpc.client.GlobalClientInterceptorRegistry] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.751  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'addressChannelFactory' of type [net.devh.springboot.autoconfigure.grpc.client.AddressChannelFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.880  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationGlobalProperties' of type [org.springframework.beans.factory.config.PropertiesFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:00.893  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationGlobalProperties' of type [java.util.Properties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:01.060  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.stream.config.BindingServiceConfiguration$PostProcessorConfiguration' of type [org.springframework.cloud.stream.config.BindingServiceConfiguration$PostProcessorConfiguration$$EnhancerBySpringCGLIB$$941aa271] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:01.122  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.instrument.async.AsyncDefaultAutoConfiguration' of type [org.springframework.cloud.sleuth.instrument.async.AsyncDefaultAutoConfiguration$$EnhancerBySpringCGLIB$$ba36b08b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-10-01 20:21:01.148  INFO [demo-cloud-sleuth,,,] 25806 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.instrument.web.client.TraceWebClientAutoConfiguration$TraceOAuthConfiguration' of type [org.springframework.cloud.sleuth.instrument.web.client.TraceWebClientAutoConfiguration$TraceOAuthConfiguration$$EnhancerBySpringCGLIB$$174f96cb] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

There might be other potential issues regarding not being post-processed by BeanPostProcessors. This issue https://github.com/yidongnan/grpc-spring-boot-starter/issues/50 might be one of them,

I'll later try to provide a patch to fix the issue I encountered above.

Add build-metadata to releases

Packaged jars usually contain a /META-INF/MANIFEST.MF which is automatically created by most build-tools. It would nice if you could configure gradle to automatically add some basic meta-data to your jars.

The result would then look like this (here from the junit libs):

Manifest-Version: 1.0
Created-By: 10.0.1 (Oracle Corporation 10.0.1+10)
Built-By: JUnit Team
Build-Date: 2018-09-11
Build-Time: 06:47:21.371+0200
Build-Revision: dba2872dd8a2575722c08d87932999f9c8ef9e0d
Specification-Title: junit-jupiter-api
Specification-Version: 5.3.1
Specification-Vendor: junit.org
Implementation-Title: junit-jupiter-api
Implementation-Version: 5.3.1
Implementation-Vendor: junit.org
Automatic-Module-Name: org.junit.jupiter.api

This allows your users to check which version of the software they are using even after the file name was stripped of its version number.

I'm not sure how this works in gradle, maybe you are more familiar with it: https://github.com/junit-team/junit5/blob/master/build.gradle#L20

Springboot Method Level Security not working with GRPC

I setup a Springboot (SSL) application with GRPC, including few REST controllers too.
Method Level Security not working in GRPC controllers, neither inside invoked service layer and jpa layer methods too.
Still works well in REST controllers.

Status{code=UNKNOWN, description=null, cause=null} is retrieved when invoke a GRPC service method with @PreAuthorize("hasAuthority('ROLE')"). I checked with debug that SecurityContextHolder does not have an Authentication object.

In maven pom.xml, dependencies are presented as below.

        <groupId>net.devh</groupId>
        <artifactId>grpc-server-spring-boot-starter</artifactId>
        <version>1.2.0.RELEASE</version>
        <groupId>net.devh</groupId>
        <artifactId>grpc-client-spring-boot-starter</artifactId>
        <version>1.2.0.RELEASE</version>

Is this a configuration issue with this dependency, or seems I am missing something?

Should I do some JWK configuration?

Loading 1.1.0 via gradle gives error

When I updated 1.0.2.RELEASE -> 1.1.0.RELEASE in my gradle file and do a clean build, I'm getting the following error:

Classpath entry points to a file that is not a JAR archive: /Users/jback/.gradle/caches/modules-2/files-2.1/net.devh/grpc-server-spring-boot-starter/1.1.0.RELEASE/597c601f63d24b1b6eeed8cb51710d79c6279d3d/grpc-server-spring-boot-starter-1.1.0.RELEASE.jar.asc

Unresolved reference: devh

Not sure that this happens for everyone, but likely since 1.0.2.RELEASE loaded fine and nothing else has changed in my gradle file.

example cloud server error

When trying to run the example with eureka the, grpc server fails when doing gradle bootRun

Here's the output

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.4.2.RELEASE)

2017-02-24 16:51:56.211  INFO 27750 --- [           main] n.d.e.grpc.cloud.GrpcServerApplication   : No active profile set, falling back to default profiles: default
2017-02-24 16:51:56.242  INFO 27750 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@55dfcc6: startup date [Fri Feb 24 16:51:56 CET 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@5f8edcc5
2017-02-24 16:51:57.173  WARN 27750 --- [           main] o.s.c.a.ConfigurationClassPostProcessor  : Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2017-02-24 16:51:57.381  INFO 27750 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=1d040b96-34c5-3114-822a-169dd1faa1b2
2017-02-24 16:51:57.457  INFO 27750 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2017-02-24 16:51:57.589  INFO 27750 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$b546266] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-02-24 16:51:57.860  INFO 27750 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 0 (http)
2017-02-24 16:51:57.875  INFO 27750 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
2017-02-24 16:51:57.876  INFO 27750 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.6
2017-02-24 16:51:58.011  INFO 27750 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-02-24 16:51:58.011  INFO 27750 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1769 ms
2017-02-24 16:51:58.259  INFO 27750 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2017-02-24 16:51:58.264  INFO 27750 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'metricsFilter' to: [/*]
2017-02-24 16:51:58.264  INFO 27750 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-02-24 16:51:58.264  INFO 27750 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-02-24 16:51:58.265  INFO 27750 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-02-24 16:51:58.265  INFO 27750 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2017-02-24 16:51:58.265  INFO 27750 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2017-02-24 16:51:58.265  INFO 27750 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'applicationContextIdFilter' to: [/*]
2017-02-24 16:51:58.853  INFO 27750 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@55dfcc6: startup date [Fri Feb 24 16:51:56 CET 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@5f8edcc5
2017-02-24 16:51:58.999  INFO 27750 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-02-24 16:51:59.001  INFO 27750 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-02-24 16:51:59.047  INFO 27750 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-02-24 16:51:59.047  INFO 27750 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-02-24 16:51:59.097  INFO 27750 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-02-24 16:51:59.259  WARN 27750 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nettyGrpcServiceFactory' defined in class path resource [net/devh/springboot/autoconfigure/grpc/server/GrpcServerAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [net.devh.springboot.autoconfigure.grpc.server.NettyGrpcServerFactory]: Factory method 'nettyGrpcServiceFactory' threw exception; nested exception is java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V
2017-02-24 16:51:59.262  INFO 27750 --- [           main] o.apache.catalina.core.StandardService   : Stopping service Tomcat
2017-02-24 16:51:59.282  INFO 27750 --- [           main] utoConfigurationReportLoggingInitializer : 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-02-24 16:51:59.292 ERROR 27750 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nettyGrpcServiceFactory' defined in class path resource [net/devh/springboot/autoconfigure/grpc/server/GrpcServerAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [net.devh.springboot.autoconfigure.grpc.server.NettyGrpcServerFactory]: Factory method 'nettyGrpcServiceFactory' threw exception; nested exception is java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1128) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1022) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:512) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:754) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
        at net.devh.examples.grpc.cloud.GrpcServerApplication.main(GrpcServerApplication.java:19) [main/:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [net.devh.springboot.autoconfigure.grpc.server.NettyGrpcServerFactory]: Factory method 'nettyGrpcServiceFactory' threw exception; nested exception is java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        ... 18 common frames omitted
Caused by: java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V
        at io.grpc.ServiceDescriptor.validateMethodNames(ServiceDescriptor.java:129) ~[grpc-core-1.1.2.jar:1.1.2]
        at io.grpc.ServiceDescriptor.<init>(ServiceDescriptor.java:83) ~[grpc-core-1.1.2.jar:1.1.2]
        at io.grpc.ServiceDescriptor.<init>(ServiceDescriptor.java:51) ~[grpc-core-1.1.2.jar:1.1.2]
        at io.grpc.ServiceDescriptor$Builder.build(ServiceDescriptor.java:219) ~[grpc-core-1.1.2.jar:1.1.2]
        at net.devh.examples.grpc.lib.SimpleGrpc.getServiceDescriptor(SimpleGrpc.java:251) ~[grpc-lib.jar:na]
        at net.devh.examples.grpc.lib.SimpleGrpc$SimpleImplBase.bindService(SimpleGrpc.java:84) ~[grpc-lib.jar:na]
        at net.devh.springboot.autoconfigure.grpc.server.AnnotationGrpcServiceDiscoverer.findGrpcServices(AnnotationGrpcServiceDiscoverer.java:52) ~[grpc-server-spring-boot-autoconfigure-1.0.1.SNAPSHOT.jar:na]
        at net.devh.springboot.autoconfigure.grpc.server.GrpcServerAutoConfiguration.nettyGrpcServiceFactory(GrpcServerAutoConfiguration.java:46) ~[grpc-server-spring-boot-autoconfigure-1.0.1.SNAPSHOT.jar:na]
        at net.devh.springboot.autoconfigure.grpc.server.GrpcServerAutoConfiguration$$EnhancerBySpringCGLIB$$10812bd.CGLIB$nettyGrpcServiceFactory$3(<generated>) ~[grpc-server-spring-boot-autoconfigure-1.0.1.SNAPSHOT.jar:na]
        at net.devh.springboot.autoconfigure.grpc.server.GrpcServerAutoConfiguration$$EnhancerBySpringCGLIB$$10812bd$$FastClassBySpringCGLIB$$8722a552.invoke(<generated>) ~[grpc-server-spring-boot-autoconfigure-1.0.1.SNAPSHOT.jar:na]
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        at net.devh.springboot.autoconfigure.grpc.server.GrpcServerAutoConfiguration$$EnhancerBySpringCGLIB$$10812bd.nettyGrpcServiceFactory(<generated>) ~[grpc-server-spring-boot-autoconfigure-1.0.1.SNAPSHOT.jar:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
        ... 19 common frames omitted

:examples:cloud-grpc-server:bootRun FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':examples:cloud-grpc-server:bootRun'.
> Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Can you have a look?

thanks!

支持直接DNS解析寻址?

@GrpcClient(value="xxx-hostname")

类似@FeignClient,默认支持DNS主机名寻找服务,不依赖eureka
也不依赖配置

连接超时错误:使用eureka注册和发现client找到了grpc-server地址,但是一直报连接超时。

client日志如下:
`2018-08-23 11:06:30.290 ERROR 6664 --- [nio-8081-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is io.grpc.StatusRuntimeException: UNAVAILABLE] with root cause

java.lang.RuntimeException: UNAVAILABLE: NameResolver returned an empty list
at net.devh.springboot.autoconfigure.grpc.client.DiscoveryClientNameResolver$1.run(DiscoveryClientNameResolver.java:130) ~[grpc-client-spring-boot-autoconfigure-2.0.1.RELEASE.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_31]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_31]

2018-08-23 11:06:52.377 WARN 6664 --- [ault-executor-0] io.grpc.internal.ManagedChannelImpl : [io.grpc.internal.ManagedChannelImpl-1] Failed to resolve name. status=Status{code=UNAVAILABLE, description=null, cause=java.lang.RuntimeException: UNAVAILABLE: NameResolver returned an empty list
at net.devh.springboot.autoconfigure.grpc.client.DiscoveryClientNameResolver$1.run(DiscoveryClientNameResolver.java:130)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
}
2018-08-23 11:06:52.377 INFO 6664 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2018-08-23 11:06:52.377 INFO 6664 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2018-08-23 11:06:52.377 INFO 6664 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2018-08-23 11:06:52.377 INFO 6664 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Application is null : false
2018-08-23 11:06:52.377 INFO 6664 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2018-08-23 11:06:52.377 INFO 6664 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Application version is -1: false
2018-08-23 11:06:52.377 INFO 6664 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2018-08-23 11:06:52.417 INFO 6664 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : The response status is 200
2018-08-23 11:06:56.630 INFO 6664 --- [ault-executor-0] n.d.s.a.g.c.DiscoveryClientNameResolver : Ready to update grpc-server server info group list
2018-08-23 11:06:56.630 INFO 6664 --- [ault-executor-0] n.d.s.a.g.c.DiscoveryClientNameResolver : Found gRPC server grpc-server 172.12.1.115:47274
2018-08-23 11:09:24.437 ERROR 6664 --- [nio-8081-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is io.grpc.StatusRuntimeException: UNAVAILABLE: io exception] with root cause

java.net.ConnectException: Connection timed out: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_31]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:716) ~[na:1.8.0_31]
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:325) ~[netty-transport-4.1.27.Final.jar:4.1.27.Final]
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:340) ~[netty-transport-4.1.27.Final.jar:4.1.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:634) ~[netty-transport-4.1.27.Final.jar:4.1.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581) ~[netty-transport-4.1.27.Final.jar:4.1.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498) ~[netty-transport-4.1.27.Final.jar:4.1.27.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460) ~[netty-transport-4.1.27.Final.jar:4.1.27.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884) ~[netty-common-4.1.27.Final.jar:4.1.27.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.27.Final.jar:4.1.27.Final]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_31]
`

TLS support?

Hi,

Looking to have TLS support for this. Ideally, an end user would configure grpc.security.enabled=true, grpc.security.trustStorePath = "foo", grpc.security.certificatePath="bar". Do these 3 properties sound like a reasonable approach? If so, I'll go ahead and send a PR

Unexpected error occurred on client after upgrading to grpc 1.2.0

My test demo is also from saturnism.

url: https://github.com/saturnism/grpc-java-demos/tree/master/springboot

grpc-spring-boot-starter itself is ok. But when I start an eureka and grpc server, then issue a request from client, some error occurr.

This is the error stack:

2017-05-14 18:31:19 [pool-8-thread-1] ERROR [TaskUtils.java:95] - Unexpected error occurred in scheduled task.
io.grpc.StatusRuntimeException: UNAVAILABLE: Transport closed for unknown reason
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:227)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:208)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:141)
at com.example.echo.EchoServiceGrpc$EchoServiceBlockingStub.echo(EchoServiceGrpc.java:135)
at com.example.grpc.springboot.Cmd.requestRegular(Cmd.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Support for TLS usage in client

Referring to net.devh.springboot.autoconfigure.grpc.client.AddressChannelFactory:

Here is what i did before using your lib to connec a clientt to a TLS enabled Server:

ManagedChannel channel = ManagedChannelBuilder.forAddress(HOST,PORT)
                .useTransportSecurity()
                .enableFullStreamDecompression()
                .build();

I don't seem to find a way to achieve a similar thing using the client starter. Am i missing something?

If not:
Would it be possible to add two properties according the use of TLS and streamCompression? Would you consider a PR for that?

Expose service availability to actuator

It would be nice, if clients would report offline/online services to the actuator health endpoint.

The same also applies to the server, but the grpc library does not yet expose that value to other beans:
grpc/grpc-java#4992

I'm not sure, whether/when I can PR that feature.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.