polarismesh / grpc-java-polaris Goto Github PK
View Code? Open in Web Editor NEWgRPC-Java integrates with Polaris Service Discovery and Governance
License: Other
gRPC-Java integrates with Polaris Service Discovery and Governance
License: Other
看README.md
中是polaris://serviceName?key=value
, 但是这么填的话, 在PolarisNameResolverProvider.newNameResolver()
中匹配不了正则表达式导致异常 😭 .
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.
求问。目前maven仓库里还没这个项目
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.
使用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
1、权重设置无效,注册2个provider,一个设置20% 一个设置100% 但是实际消费情况与权重无关
2、注册2个provider,一个设置0% 一个设置100% 有效
Describe the bug
服务端无可用服务,或服务端的地址配置错误时。
客户端的请求会hang住,且没有任何报错信息。
To Reproduce
在quickstart-example项目中只启动客户端进行访问即可
Expected behavior
抛出异常即可
Environment
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
我们部门有一套k8s服务、然后grpc服务下线的时候不是用的jvm hook来通知注册中心嘛。就会造成下线不稳定、有时候不能主动下线成功。
Provider启动正常,但是启动Consumer时这一句HelloPolaris.response response = hiBlockingStub.sayHi(request);卡住。麻烦帮忙看一下。
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();
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.