Skip to content

filter: check if connection is open before and after filter read/write#7256

Merged
mattklein123 merged 5 commits intoenvoyproxy:masterfrom
yxue:segfault
Jun 13, 2019
Merged

filter: check if connection is open before and after filter read/write#7256
mattklein123 merged 5 commits intoenvoyproxy:masterfrom
yxue:segfault

Conversation

@yxue
Copy link
Copy Markdown
Member

@yxue yxue commented Jun 13, 2019

Signed-off-by: Yan Xue yxyan@google.com

Description: Check if connection is open before and after filter read/write. In onData or onWrite, filter could close the underlying connection.
Risk Level: Low
Testing: unit test
Docs Changes: N/A
Release Notes: N/A
[Optional Fixes #Issue]
[Optional Deprecated:]

Signed-off-by: Yan Xue <yxyan@google.com>
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. While I think this change is generally correct, historically we have assumed that filters will stop iteration if they close the connection/stream. WDYT about just putting in asserts to this effect? it would be a much less scary change.

/wait-any

@yxue
Copy link
Copy Markdown
Member Author

yxue commented Jun 13, 2019

Thanks for working on this. While I think this change is generally correct, historically we have assumed that filters will stop iteration if they close the connection/stream. WDYT about just putting in asserts to this effect? it would be a much less scary change.

/wait-any

I think the assumption is totally correct but sometimes users might not follow it or they are not intend to break the assumption. I found this bug from a filter extended by istio/mixer.

I think either of them is ok. I would prefer providing some tolerance when users don't follow the convention rather than terminating the process. WDYT?

@mattklein123
Copy link
Copy Markdown
Member

I think either of them is ok. I would prefer providing some tolerance when users don't follow the convention rather than terminating the process. WDYT?

Fair enough. Sounds good.

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. My general preference here is to have a check after a filter runs, since I can see easily making that mistake, but asserts otherwise.

/wait

Signed-off-by: Yan Xue <yxyan@google.com>
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, do you have test coverage for all of these new cases?

/wait

Signed-off-by: Yan Xue <yxyan@google.com>
@yxue
Copy link
Copy Markdown
Member Author

yxue commented Jun 13, 2019

Thanks, do you have test coverage for all of these new cases?

/wait

I have 2 tests which should cover these cases.

Signed-off-by: Yan Xue <yxyan@google.com>
@mattklein123
Copy link
Copy Markdown
Member

If you were able to change the if statement after the filter call without changing your tests, I don't think your tests are complete. Please make them more robust to cover all cases.

/wait

Signed-off-by: Yan Xue <yxyan@google.com>
@yxue
Copy link
Copy Markdown
Member Author

yxue commented Jun 13, 2019

If you were able to change the if statement after the filter call without changing your tests, I don't think your tests are complete. Please make them more robust to cover all cases.

/wait

I didn't add test for onWrite. Now the test case should cover both read and write. @mattklein123 could you please take a look?

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.

LGTM, thank you!

@yxue
Copy link
Copy Markdown
Member Author

yxue commented Jun 13, 2019

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🤷‍♀️ nothing to rebuild.

🐱

Caused by: a #7256 (comment) was created by @crazyxy.

see: more, trace.

@yxue
Copy link
Copy Markdown
Member Author

yxue commented Jun 13, 2019

/azp run

@azure-pipelines
Copy link
Copy Markdown

Commenter does not have sufficient privileges for PR 7256 in repo envoyproxy/envoy

@mattklein123 mattklein123 merged commit 3b4b500 into envoyproxy:master Jun 13, 2019
@yxue yxue deleted the segfault branch July 1, 2019 17:45
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