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

ext_authz: Avoid calling check multiple times #13288

Merged
merged 13 commits into from
Oct 16, 2020
Merged

ext_authz: Avoid calling check multiple times #13288

merged 13 commits into from
Oct 16, 2020

Conversation

dio
Copy link
Member

@dio dio commented Sep 28, 2020

Commit Message: This patch makes sure the filter sends exactly only one check request when the buffer is full, while there might be more data to be decoded.

Risk Level: Low
Testing: Unit test
Docs Changes: N/A
Release Notes: N/A
Fixes #13260

Signed-off-by: Dhi Aurrahman dio@tetrate.io

This patch makes sure the filter sends check request once when buffer is
full, while there might be more data to be decoded.

Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
@dio dio marked this pull request as ready for review September 28, 2020 04:57
@junr03
Copy link
Member

junr03 commented Sep 29, 2020

@dio @brectanus-sigsci reported new evidence on the related issue. Can you take a look? I can review after that is settled

/wait

dio added 2 commits September 30, 2020 02:17
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
@dio
Copy link
Member Author

dio commented Sep 30, 2020

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines, to retry CircleCI checks, use /retest-circle.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #13288 (comment) was created by @dio.

see: more, trace.

@brectanus-sigsci
Copy link
Contributor

@dio @brectanus-sigsci reported new evidence on the related issue. Can you take a look? I can review after that is settled

/wait

@junr03 @dio Seems good to review now. Just pinging on this. Thanks!

Copy link
Member

@junr03 junr03 left a comment

Choose a reason for hiding this comment

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

lgtm. although, I am less familiar than I would like with the filter requirements. Just to confirm @brectanus-sigsci this patch fixes your issue and is the expected behavior?

test/extensions/filters/http/ext_authz/ext_authz_test.cc Outdated Show resolved Hide resolved
junr03
junr03 previously approved these changes Oct 13, 2020
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

One quick question, thanks for fixing!

/wait-any

Comment on lines 326 to 330
if (buffer_data_ && !skip_check_) {
// When the filter is asked to buffer the data but the buffer is full, it skips buffering more
// data for the next iteration.
buffer_data_ = !isBufferFull();
}
Copy link
Member

Choose a reason for hiding this comment

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

Can you just do buffer_data_ = false; here? When we continue after a pause aren't we done and never want to buffer again?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you're right. Thank you for this. Updated.

Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
Comment on lines 327 to 328
// After sending the out the check request, we don't need to buffer the data anymore.
buffer_data_ = false;
Copy link
Member

Choose a reason for hiding this comment

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

Sorry what I mean is just remove the if statement and universally set it to false. I think that should be fine?

/wait

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, sorry, my fault. Pushed an update.

Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
@brectanus-sigsci
Copy link
Contributor

@dio Can you create another docker image with the latest changes so I can retest?

@dio
Copy link
Member Author

dio commented Oct 14, 2020

@brectanus-sigsci sorry for the delay, but here it is: docker pull dio123/envoy:ext-authz-13260-2.

@brectanus-sigsci
Copy link
Contributor

@dio Retest. Still looks good. Thanks so much for getting this fixed!

// After sending the out the check request, we don't need to buffer the data anymore.
buffer_data_ = false;
}
// After sending the out the check request, we don't need to buffer the data anymore.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// After sending the out the check request, we don't need to buffer the data anymore.
// After sending the check request, we don't need to buffer the data anymore.

/wait

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks!

@mattklein123
Copy link
Member

Sorry merge main one more time?

/wait

@mattklein123
Copy link
Member

Merge main once #13598 merges. Thanks!

/wait

@lizan
Copy link
Member

lizan commented Oct 15, 2020

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines, to retry CircleCI checks, use /retest-circle.
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #13288 (comment) was created by @lizan.

see: more, trace.

@lizan lizan merged commit 2196214 into envoyproxy:master Oct 16, 2020
mpuncel added a commit to mpuncel/envoy that referenced this pull request Oct 17, 2020
* master: (22 commits)
  delay health checks until transport socket secrets are ready. (envoyproxy#13516)
  test, oauth2: Make sure config test runs field validation (envoyproxy#13496)
  [http] swap codec implementations to default new (envoyproxy#13579)
  wasm: update proxy-wasm-cpp-host (envoyproxy#13606)
  postgres: do not copy and linearize received data when it is not going to be used (envoyproxy#13393)
  configs: Update configs v2 -> v3 (envoyproxy#13562)
  http2: Remove RELEASE_ASSERTs in sendPendingFrames() error handling (envoyproxy#13546)
  dependencies: track untracked implied dependencies, wrapup dashboard. (envoyproxy#13571)
  listener: add match all filter chain (envoyproxy#13449)
  fix mistakes in docstrings (envoyproxy#13603)
  ratelimit: add route entry metadata to ratelimit actions (envoyproxy#13269)
  cluster manager: avoid immediate activation for dynamic inserted cluster when initialize (envoyproxy#12783)
  ext_authz: Avoid calling check multiple times (envoyproxy#13288)
  docs: Unexclude remaining configs from validation (envoyproxy#13534)
  build: update rules_rust to allow Rustc in RBE (envoyproxy#13595)
  docs: Update sphinxext.rediraffe (envoyproxy#13589)
  Deprecate moonjit support on Windows before beta (envoyproxy#13541)
  dependencies: bump LuaJIT to 2.1 branch HEAD @ e9af1ab. (envoyproxy#13474)
  docs: add TLS stats to cluster stats doc (envoyproxy#13561)
  ci: stop building alpine-debug images in favor of ubuntu-based debug image (envoyproxy#13598)
  ...

Signed-off-by: Michael Puncel <mpuncel@squareup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ext_authz gRPC with a request body may be called multiple times for the same request
5 participants