Skip to content

http: moving strict header checking into the http/1.1 codec#7601

Merged
mattklein123 merged 11 commits intoenvoyproxy:masterfrom
alyssawilk:fix_runtime_checks
Jul 26, 2019
Merged

http: moving strict header checking into the http/1.1 codec#7601
mattklein123 merged 11 commits intoenvoyproxy:masterfrom
alyssawilk:fix_runtime_checks

Conversation

@alyssawilk
Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk commented Jul 16, 2019

As discovered on #7306 runtime checks don't work well outside of worker threads.
This leverages the fixed over in #7695 to move strict header checking to the codec.

Risk Level: Medium (messing with runtime, HTTP/1 parsing)
Testing: previously failing integration tests now pass
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk
Copy link
Copy Markdown
Contributor Author

@mattklein123 thoughts on the options above?

Copy link
Copy Markdown
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 for working on this. Yeah I agree (3) is the right approach for now. I think though we only ever need const access to the snapshot. That is how it works today. Though I'm not quite sure how you are going to actually post snapshot updates to non-worker threads. For now I think it's probably sufficient to just have a non-worker thread "current snapshot" which we acquire via a shared pointer read lock? And then the current snapshot is updated with a write lock? This would keep worker thread access lock free, and then in the future we could potentially allow non-worker threads to register for dispatcher updates if they run an event loop (or just implement a post like interface). WDYT?

/wait

*
* @return true if this is a valid slot (called from a worker thread).
*/
virtual bool valid() PURE;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: currentThreadInitialized() or similar?

@alyssawilk
Copy link
Copy Markdown
Contributor Author

I think we can actually do one better, and make snapshot access actually const - looks like nothing but test code uses non-const and I can fix that up. If so we can combine 2 and 3 for a fairly simple solution.
I'll go ahead and land that as a standone PR now, to see if it causes anyone trouble, then go fix this one up to use it.

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
alyssawilk added a commit that referenced this pull request Jul 22, 2019
This is a precursor to #7601 just to land the API change more quickly and make sure it sticks.

Risk Level: Low
Testing: existing unit tests
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk
Copy link
Copy Markdown
Contributor Author

Ok, I think this works better, but I want to see how CI is and probably do one more clean up pass before I remove the waiting tag.
Matt one question if you have a few, do you think this is large enough I should split the runtime change out from the HTTP feature port or leave them together?

@mattklein123
Copy link
Copy Markdown
Member

Matt one question if you have a few, do you think this is large enough I should split the runtime change out from the HTTP feature port or leave them together?

Optimally I think it's worth splitting it out if you don't mind, but it's not a big deal to me either way.

@alyssawilk
Copy link
Copy Markdown
Contributor Author

I prefer smaller safer PRs so I'll close this off for a few and reopen once the runtime-only change has landed.

@alyssawilk alyssawilk closed this Jul 23, 2019
alyssawilk added a commit that referenced this pull request Jul 25, 2019
Making runtime accessible for non-worker threads, and using the new accessor for runtime features.

This allows the work done in #7601, moving the strict HTTP checks out of the HCM and into the codec, where the integration tests use them from client/server threads, and other downstream Envoys might use them from non-worker threads as well.

Risk Level: High (affects runtime access for all runtime features)
Testing: new unit tests, integration tests use in #7601
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
@alyssawilk alyssawilk reopened this Jul 25, 2019
@alyssawilk alyssawilk changed the title WIP: runtime: fix runtime checks to work out of worker threads http: moving strict header checking into the http/1.1 codec Jul 25, 2019
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Copy link
Copy Markdown
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.

Yay awesome cleanup.

@mattklein123 mattklein123 merged commit 9ea7ea2 into envoyproxy:master Jul 26, 2019
@alyssawilk alyssawilk deleted the fix_runtime_checks branch July 31, 2019 20:32
mattklein123 pushed a commit that referenced this pull request Aug 13, 2019
This is a precursor to #7601 just to land the API change more quickly and make sure it sticks.

Risk Level: Low
Testing: existing unit tests
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
mattklein123 pushed a commit that referenced this pull request Aug 13, 2019
Making runtime accessible for non-worker threads, and using the new accessor for runtime features.

This allows the work done in #7601, moving the strict HTTP checks out of the HCM and into the codec, where the integration tests use them from client/server threads, and other downstream Envoys might use them from non-worker threads as well.

Risk Level: High (affects runtime access for all runtime features)
Testing: new unit tests, integration tests use in #7601
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
LukeShu pushed a commit to gravitee-io/envoy that referenced this pull request Aug 26, 2019
This is a precursor to envoyproxy#7601 just to land the API change more quickly and make sure it sticks.

Risk Level: Low
Testing: existing unit tests
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
LukeShu pushed a commit to gravitee-io/envoy that referenced this pull request Aug 26, 2019
…y#7695) (#27)

Making runtime accessible for non-worker threads, and using the new accessor for runtime features.

This allows the work done in envoyproxy#7601, moving the strict HTTP checks out of the HCM and into the codec, where the integration tests use them from client/server threads, and other downstream Envoys might use them from non-worker threads as well.

Risk Level: High (affects runtime access for all runtime features)
Testing: new unit tests, integration tests use in envoyproxy#7601
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
LSChyi pushed a commit to LSChyi/envoy that referenced this pull request Sep 24, 2019
…yproxy#26)

This is a precursor to envoyproxy#7601 just to land the API change more quickly and make sure it sticks.

Risk Level: Low
Testing: existing unit tests
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: LSChyi <alan81920@gmail.com>
LSChyi pushed a commit to LSChyi/envoy that referenced this pull request Sep 24, 2019
…y#7695) (envoyproxy#27)

Making runtime accessible for non-worker threads, and using the new accessor for runtime features.

This allows the work done in envoyproxy#7601, moving the strict HTTP checks out of the HCM and into the codec, where the integration tests use them from client/server threads, and other downstream Envoys might use them from non-worker threads as well.

Risk Level: High (affects runtime access for all runtime features)
Testing: new unit tests, integration tests use in envoyproxy#7601
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Signed-off-by: LSChyi <alan81920@gmail.com>
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.

2 participants