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

The attributes of the address is removed when passing to the picker. #4276

Closed
MooooonStar opened this issue Mar 18, 2021 · 2 comments · Fixed by #4253
Closed

The attributes of the address is removed when passing to the picker. #4276

MooooonStar opened this issue Mar 18, 2021 · 2 comments · Fixed by #4253

Comments

@MooooonStar
Copy link

I am using my own balancer.PickerBuilder in my program. I attach some info to the address with the func SetAddrInfo in weightedroundrobin.go and read it from Build(info PickerBuildInfo) balancer.Picker.

It works well in grpc-go@v1.34.0, but failed in grpc-go@v1.35.0.

I read the release note and find this strip attributes from addresses.

In the function

func (b *baseBalancer) regeneratePicker() {
	if b.state == connectivity.TransientFailure {
		b.picker = NewErrPicker(b.mergeErrors())
		return
	}
	readySCs := make(map[balancer.SubConn]SubConnInfo)

	// Filter out all ready SCs from full subConn map.
	for addr, sc := range b.subConns {
		if st, ok := b.scStates[sc]; ok && st == connectivity.Ready {
			readySCs[sc] = SubConnInfo{Address: addr}
		}
	}
	b.picker = b.pickerBuilder.Build(PickerBuildInfo{ReadySCs: readySCs})
}

It uses b.subConns to pass ready connections to the picker. But the key in b.subConns contains no attributes now. So I got

empty attributes and my program failed.

It is a feature or a bug? What should I do?

@menghanl
Copy link
Contributor

There's a PR for this: #4253
Can you take a look and see if it solves the problem?

@MooooonStar
Copy link
Author

oh, yes! I works. It seems that he got the same problem as me.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants