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

potential problem with pkg/gate package #5988

Closed
johncming opened this issue Sep 5, 2019 · 4 comments
Closed

potential problem with pkg/gate package #5988

johncming opened this issue Sep 5, 2019 · 4 comments

Comments

@johncming
Copy link
Contributor

johncming commented Sep 5, 2019

There's a potential problem with pkg/gate package.

prometheus/promql/engine.go

Lines 387 to 390 in ead0933

if err := ng.gate.Start(ctx); err != nil {
return nil, nil, contextErr(err, "query queue")
}
defer ng.gate.Done()

The current gate implementation can easily panic if length is 0.

case <-g.ch:

If capacity 0, Start return because timeout.

Two proposals:

  1. Close channel when Start timeout returns
  2. Create a Gate interface, channelGate is just an implementation. Add other implementations later
@roidelapluie
Copy link
Member

Do you have a way to reproduce this?

@roidelapluie
Copy link
Member

Friendly ping @johncming

@johncming
Copy link
Contributor Author

Friendly ping @johncming

I try it but not find a way to reproduce. I find this issue when reading code.

@beorn7
Copy link
Member

beorn7 commented Mar 26, 2024

Hello from the bug scrub.

We assume that the case raised in this issue can never happen. Closing, but please feel free to follow up with more evidence.

@beorn7 beorn7 closed this as completed Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants