Skip to content

Ensure queries are cancelled correctly via the frontend. #1508

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

Merged
merged 2 commits into from
Jul 17, 2019

Conversation

tomwilkie
Copy link
Contributor

@tomwilkie tomwilkie commented Jul 11, 2019

Signed-off-by: Tom Wilkie tom.wilkie@gmail.com

Should mostly be a simplification of the frontend.Process method's concurrency. And an extra goroutine in the client for this (worker.go).

And a unit test to show it works now.

And test it works.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
@tomwilkie tomwilkie force-pushed the dont-retry-cancelled-queries branch from 1c96c7e to 089c384 Compare July 12, 2019 10:51
@tomwilkie tomwilkie changed the title Don't retry cancelled queries. Ensure queries are cancelled correctly via the frontend. Jul 12, 2019
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
@bboreham
Copy link
Contributor

Fixes #1313 ?

@tomwilkie
Copy link
Contributor Author

Yes! Sorry didn't know we had an issue for that.

Copy link
Contributor

@gouthamve gouthamve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious what you think about the DOS probability.

case err := <-errChan:
request.err <- err
// If the upstream reqeust is cancelled, we need to cancel the
// downstream req. Only way we can do that is to close the stream.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means if 5 requests are being handled on this stream, all of them will error out?

Copy link
Contributor

@gouthamve gouthamve Jul 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means a user can DOS the service by just sending requests and immediately cancelling them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should only ever be one concurrent request per stream, so I don't think this is a problem.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right!

Copy link
Contributor

@gouthamve gouthamve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

case err := <-errChan:
request.err <- err
// If the upstream reqeust is cancelled, we need to cancel the
// downstream req. Only way we can do that is to close the stream.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right!

@tomwilkie tomwilkie merged commit 2d7ab94 into master Jul 17, 2019
@tomwilkie tomwilkie deleted the dont-retry-cancelled-queries branch July 17, 2019 16:04
@bboreham
Copy link
Contributor

bboreham commented Sep 5, 2019

As far as I can see this isn't working.
I commented before that I couldn't see how to close the stream, and I can't see how this code closes the stream. Can you explain?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants