Giter VIP home page Giter VIP logo

grpc-java-polaris's People

Contributors

1182640071 avatar andrewshan avatar chuntaojun avatar lepdou avatar li-xiao-shuang avatar lingting avatar ranchowang avatar stan9333 avatar wang007 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

grpc-java-polaris's Issues

在限制系统资源并且高并发下,客户端出现卡住且无响应

在k8s集群中,限制容器系统资源,在高并发下,客户端执行rpc调用时会出现全部请求都卡住无响应的情况,grpc服务端未收到调用请求,客户端也不会超时,没有异常信息,不确定是不是死锁。配置除了注册中心地址,其他基本使用默认配置。不接入polaris注册中心时不会出现。服务端是用go提供的grpc服务。
下图是可能的异常堆栈:
image

环境版本:
应用基础镜像:openjdk:8-jdk-alpine
polaris-java版本: 1.10.1, 1.10.4
grpc版本:1.47.0,1.52.1

完善项目的单元测试覆盖

What is the feature you want to add?

Why do you want to add this feature?

How to implement this feature?

Additional context
Add any other context or screenshots about the feature request here.

Examples optimize options

  1. split provider and consumer into 2 separated projects
  2. provide executable fat jar build command for examples

Consumer调用服务时异常

使用example的例子,provider可以正常启动并接入,consumer启动后在调用服务时会抛出以下类型转换异常并卡住。异常的代码处,会进入两次,第一次进入时类型时正确的不会抛异常,第二次是一个异步调用进入的,类型不匹配。麻烦看一下,谢谢。

Caused by: java.lang.ClassCastException: com.tencent.polaris.grpc.loadbalance.PolarisSubChannel cannot be cast to com.tencent.polaris.client.pojo.InstanceByProto
	at com.tencent.polaris.client.util.Utils.isHealthyInstance(Utils.java:100)
	at com.tencent.polaris.plugins.router.healthy.RecoverRouter.lambda$router$0(RecoverRouter.java:52)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
	at com.tencent.polaris.plugins.router.healthy.RecoverRouter.router(RecoverRouter.java:53)
	at com.tencent.polaris.plugins.router.common.AbstractServiceRouter.getFilteredInstances(AbstractServiceRouter.java:69)
	at com.tencent.polaris.client.flow.BaseFlow.processRouterChain(BaseFlow.java:172)
	at com.tencent.polaris.client.flow.BaseFlow.processServiceRouters(BaseFlow.java:147)
	at com.tencent.polaris.router.client.api.DefaultRouterAPI.processRouters(DefaultRouterAPI.java:138)
	at com.tencent.polaris.grpc.loadbalance.PolarisPicker.doRoute(PolarisPicker.java:167)
	at com.tencent.polaris.grpc.loadbalance.PolarisPicker.pickSubchannel(PolarisPicker.java:116)
	at io.grpc.internal.DelayedClientTransport.reprocess(DelayedClientTransport.java:297)
	at io.grpc.internal.ManagedChannelImpl.updateSubchannelPicker(ManagedChannelImpl.java:896)
	at io.grpc.internal.ManagedChannelImpl.access$5300(ManagedChannelImpl.java:118)
	at io.grpc.internal.ManagedChannelImpl$LbHelperImpl$1UpdateBalancingState.run(ManagedChannelImpl.java:1476)
	at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:95)
	at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:127)
	at io.grpc.internal.InternalSubchannel$TransportListener.transportReady(InternalSubchannel.java:547)
	at io.grpc.netty.ClientTransportLifecycleManager.notifyReady(ClientTransportLifecycleManager.java:44)
	at io.grpc.netty.NettyClientHandler$FrameListener.onSettingsRead(NettyClientHandler.java:914)
	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onSettingsRead(DefaultHttp2ConnectionDecoder.java:526)
	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$PrefaceFrameListener.onSettingsRead(DefaultHttp2ConnectionDecoder.java:745)
	at io.netty.handler.codec.http2.Http2InboundFrameLogger$1.onSettingsRead(Http2InboundFrameLogger.java:93)
	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readSettingsFrame(DefaultHttp2FrameReader.java:542)
	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:263)
	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:160)
	at io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:41)
	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:181)
	at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:378)
	at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.decode(Http2ConnectionHandler.java:242)
	at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:438)
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:508)
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:447)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:748)

Environment

  • Version: 1.1.0-SNAPSHOT
  • OS: Windows11

权重设置无效

1、权重设置无效,注册2个provider,一个设置20% 一个设置100% 但是实际消费情况与权重无关
2、注册2个provider,一个设置0% 一个设置100% 有效

没有可用服务时,客户端线程会hang住

Describe the bug
服务端无可用服务,或服务端的地址配置错误时。
客户端的请求会hang住,且没有任何报错信息。

To Reproduce
在quickstart-example项目中只启动客户端进行访问即可

Expected behavior
抛出异常即可

Environment

  • Version: master分支
  • OS: MacOS Big Sur 11.4

Additional context
原生的ManagedChannelBuilder的表现是正常的,即抛出如下异常
13:20:20.760 [pool-2-thread-1] ERROR com.tencent.polaris.grpc.ConsumerHttpHandler - ConsumerHttpHandler error io.grpc.StatusRuntimeException: UNAVAILABLE: io exception at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:262) at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:243) at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:156) at com.tencent.polaris.grpc.HelloGrpc$HelloBlockingStub.sayHello(HelloGrpc.java:157) at com.tencent.polaris.grpc.HelloConsumer.hello(HelloConsumer.java:60) at com.tencent.polaris.grpc.ConsumerHttpHandler.handle(ConsumerServer.java:66) at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79) at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83) at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82) at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:705) at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79) at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:677) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750) Caused by: io.grpc.netty.shaded.io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /127.0.0.1:2222 Caused by: java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:716) at io.grpc.netty.shaded.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:330) at io.grpc.netty.shaded.io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334) at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:707) at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655) at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581) at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) at io.grpc.netty.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:750) s

grpc polaris 无损下线

我们部门有一套k8s服务、然后grpc服务下线的时候不是用的jvm hook来通知注册中心嘛。就会造成下线不稳定、有时候不能主动下线成功。

quickstart-example里的Consumer卡住

Provider启动正常,但是启动Consumer时这一句HelloPolaris.response response = hiBlockingStub.sayHi(request);卡住。麻烦帮忙看一下。

grpc-java-polaris consumer how to set namespace ?

Exception in thread "main" java.lang.IllegalArgumentException: cannot find a NameResolver for polaris://ad.show.retrieval.svc.feeds:57823?namespace=test

VERSION : 1.0.0
CODE :
NameResolverRegistry.getDefaultRegistry().register(new PolarisNameResolverProvider());
String target = POLARIS + serviceName + "?namespace=" + nameSpace;
channel = ManagedChannelBuilder.forTarget(target).usePlaintext()
.build();

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.