polarismesh / grpc-go-polaris Goto Github PK
View Code? Open in Web Editor NEWgRPC-Go integrates with Polaris Service Discovery and Governance
License: Other
gRPC-Go integrates with Polaris Service Discovery and Governance
License: Other
polaris-go 有v2版本了, gRPC-Go with Polaris 没有同步更新gRPC-Go with Polaris
这里引用global.go的代码:
// PolarisContext get or init the global polaris context
func PolarisContext() (api.SDKContext, error) {
mutexPolarisContext.Lock()
defer mutexPolarisContext.Unlock()
if nil != polarisContext {
return polarisContext, nil
}
return api.InitContextByConfig(PolarisConfig())
}
还有resolver.go的代码:
func (pr *polarisNamingResolver) lookup() (*resolver.State, api.ConsumerAPI, error) {
sdkCtx, err := PolarisContext()
if nil != err {
return nil, nil, err
}
consumerAPI := api.NewConsumerAPIByContext(sdkCtx)
instancesRequest := &api.GetInstancesRequest{}
instancesRequest.Namespace = getNamespace(pr.options)
instancesRequest.Service = pr.target.URL.Host
………………
return state, consumerAPI, nil
}
func (pr *polarisNamingResolver) watcher() {
……………………
for {
select {
case <-pr.ctx.Done():
return
case <-pr.rn:
case <-eventChan:
}
var state *resolver.State
var err error
state, consumerAPI, err = pr.lookup()
……………………
}
}
可以看到watcher协程每次有事件时都会调用 lookup进而调用PolarisContext,PolarisContext函数这里没有给 polarisContext 全局变量赋值,导致每次都要新建北极星sdk上下文,且不会销毁,导致cpu、套接字、内存泄漏,时间长了,进程崩溃。
Describe the bug
A clear and concise description of what the bug is.
在配置中开启熔断功能,触发熔断后,客户端仍能访问到被熔断的实例
To Reproduce
Steps to reproduce the behavior.
Expected behavior
A clear and concise description of what you expected to happen.
Environment
Additional context
Add any other context about the problem here.
golangci/golangci-lint#826
golangci/golangci-lint#1517
看起来是个老问题,建议disable structcheck
希望支持 options 这种方式传参,sdk 不应该依赖配置文件和外部文件,希望把服务注册 和配置 中心变成插件化,可插拔,自己实现接口实现替换北极星部分功能,类似 go-micro 插件机制,把北极星当成控制平面使用
grpc-go-polaris/polaris_registry.go
Line 59 in 5699081
Describe the bug
节点异常关闭没有调用deRegister时,动态路由和负载均衡未过滤异常节点,导致访问出错
To Reproduce
按照 https://github.com/polarismesh/grpc-go-polaris/blob/main/examples/routing/README.md 中的流程启动三个provider和consumer之后,通过curl调用,正常返回结果
此时kill掉其中一个provider,之后多次curl调用发现会请求到已经被kill的异常节点(console后台状态显示为异常)
Expected behavior
希望官方可以修复此Bug
Environment
Additional context
通过对balancer.go文件添加日志发现
pnp.balancer.routerAPI.ProcessRouters(request)
pnp.balancer.routerAPI.ProcessLoadBalance(lbReq)
这两个调用都没有过滤掉异常节点
some interface is changed incompatible from grpc 1.25 to 1.39+, we need to support the newest version
grpc-go-polaris/polaris_ratelimit.go
Line 45 in 5699081
Describe the bug
同时 grpc-go-polaris 和 polaris-go 共存,服务名就无法解析了。grpc-go-polaris 版本是v1.2.2 polaris-go 版本是v1.1.0
To Reproduce
Steps to reproduce the behavior.
Expected behavior
A clear and concise description of what you expected to happen.
Environment
Additional context
Add any other context about the problem here.
Describe the bug
我参考polaris-go-grpc中的实现,在我的库项目woocoo集成了polaris支持,但在测试过程中发现经常发生的问题.测试方法在测试方法
To Reproduce
此测试方法主要: 1个服务的2个实例,1个客户端.通过实例的中断测试客户端访问是否正常.
[154 //time.Sleep(time.Second)](https://github.com/tsingsun/woocoo/blob/497566d6086e1dc2cb75b0afebc90c3419fc3638/contrib/polarismesh/client_test.go#L154)
建议是避免使用resolver.ResolverNow方法.
** 环境**
MacOS; docker desktop k8s; polaris k8s 部署
Describe the bug
A clear and concise description of what the bug is.
无法对接 v2 版的北极星服务
To Reproduce
使用 sdk 连接 v2 版的北极星系统。
Expected behavior
业务能够成功返回响应。
Got
错误如下
rpc error: code = Internal desc = stream terminated by RST_STREAM with error code: PROTOCOL_ERROR
Environment
Additional context
Add any other context about the problem here.
1.希望在polaris.BuildTarget的DialOption中支持设置一致性哈希算法和hashkey
2.Grpc定义的错误码太过于笼统,希望能支持注册一个解析error为错误码的接口,北极星使用这个错误码来上报
https://trac.nginx.org/nginx/ticket/2268
默认不带authority头请求Nginx grpc服务,返回400
Describe the bug
客户端在进行grpc调用时与Polaris控制面8091端口的链接为短连接
To Reproduce
持续grpc请求,netstat -ant发现很多TIME_WAIT链接.
Expected behavior
grpc-go-polaris与控制面的链接为长链接.
Environment
Additional context
Add any other context about the problem here.
目标
建议实现思路
Originally posted by @chuntaojun in polarismesh/polaris#355 (comment)
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.