Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当grpc连接状态自动进入idle后,discovery在Build中必须等带watch才会调用grpc的UpdateState方法更新状态导致连接不可用 #3551

Open
leaf-rain opened this issue Feb 12, 2025 · 11 comments
Labels
bug Something isn't working

Comments

@leaf-rain
Copy link

conn, err := grpc.DialInsecure(ctx,
	grpc.WithDiscovery(nacos.New(namingCli)),
	grpc.WithEndpoint(endpoint),
	grpc.WithTimeout(time.Duration(cfg.Timeout)*time.Second),
	grpc.WithOptions(
		grpcbase.WithKeepaliveParams(keepalive.ClientParameters{
			PermitWithoutStream: true,
		}),
		grpcbase.WithIdleTimeout(time.Second*5),
	),
)

等待5秒后,所有调用都会被hang住

@leaf-rain leaf-rain added the bug Something isn't working label Feb 12, 2025
@kratos-ci-bot
Copy link
Collaborator

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


conn, err := grpc.DialInsecure(ctx,
grpc.WithDiscovery(nacos.New(namingCli)),
grpc.WithEndpoint(endpoint),
grpc.WithTimeout(time.Duration(cfg.Timeout)time.Second),
grpc.WithOptions(
grpcbase.WithKeepaliveParams(keepalive.ClientParameters{
PermitWithoutStream: true,
}),
grpcbase.WithIdleTimeout(time.Second
5),
),
)
After waiting for 5 seconds, all calls will be stopped

@shenqidebaozi
Copy link
Member

Naocs plugin not adapted to gRPC 1.59+ idle timeout changes,can you help repair it?

@leaf-rain
Copy link
Author

Image
在etcd里面这部分代码看起来可以更新状态,这边可以借鉴一下

@kratos-ci-bot
Copy link
Collaborator

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Image
In etcd, this part of the code looks like it can be updated. Here we can learn more about it.

@leaf-rain
Copy link
Author

嗯,等有时间这边看一下有没有更好的办法修复一下吧,目前只能给这个设置空闲时间手动设置的非常大,ps: grpc默认30分钟超时

@kratos-ci-bot
Copy link
Collaborator

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Well, when you have time, see if there is any better way to fix it. At present, you can only set the idle time for this to be set manually. ps: grpc timeout by default 30 minutes

@shenqidebaozi
Copy link
Member

嗯,等有时间这边看一下有没有更好的办法修复一下吧,目前只能给这个设置空闲时间手动设置的非常大,ps: grpc默认30分钟超时

idle timeout 0

@kratos-ci-bot
Copy link
Collaborator

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Well, when you have time, see if there is any better way to fix it. At present, you can only set the idle time for this to be set manually. ps: grpc timeout 30 minutes by default

idle timeout 0

@shenqidebaozi
Copy link
Member

Image 在etcd里面这部分代码看起来可以更新状态,这边可以借鉴一下

When idle, it will notify watch close. The simplest way is to ignore close

@shenqidebaozi
Copy link
Member

select {
case <-w.ctx.Done():
return nil, w.ctx.Err()
case <-w.watchChan:

@kratos-ci-bot
Copy link
Collaborator

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


select {
case <-w.ctx.Done():
return nil, w.ctx.Err()
case <-w.watchChan:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants