-
Notifications
You must be signed in to change notification settings - Fork 173
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
Check for too big option.PipelineMultiplex value #436
Conversation
mux.go
Outdated
@@ -95,7 +95,8 @@ func newMux(dst string, option *ClientOption, init, dead wire, wireFn wireFn) *m | |||
var multiplex int | |||
if option.PipelineMultiplex >= 0 { | |||
multiplex = 1 << option.PipelineMultiplex | |||
} else { | |||
} | |||
if multiplex == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this good way? Because we just replace wrong value with default, but user never knows about problem.
I think better panic with explanation why
Thanks @atercattus! And I agree with @bald2b. It will be better to return an error to users. Actually, I don't think setting |
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #436 +/- ##
==========================================
- Coverage 95.96% 95.96% -0.01%
==========================================
Files 77 77
Lines 32410 32413 +3
==========================================
+ Hits 31103 31104 +1
- Misses 1112 1115 +3
+ Partials 195 194 -1 ☔ View full report in Codecov by Sentry. |
We set too big a value by mistake and got unexpected panic :) I think, we have two ways:
Now I'm leaning towards the second option. What do you think? |
I see, but changing the signature of I think we can just validate the value of |
We can put a hard limit of 8, resulting in 256 connections to a node. |
6e76254
to
3f462ea
Compare
Could you make a new tag? :) |
Sure. I will do it later. |
If we use
ClientOption.PipelineMultiplex
in the wrong way (too big), we will get a panic inside rueidis:https://go.dev/play/p/QE8VYHE6hJX
In this case, we will get zero for multiplex value and zero-sized
wire
,mu
,sc
slices. Which will lead to panic here for example.