-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
exception: make Ipv6Instance and Ipv4Instance not throw and remove some try catch pattern #16122
Changes from 1 commit
8dba38f
6f8c113
c564998
99b85ba
85cff42
5b44d5f
b12f57c
9bfc32e
7c73ff8
979079b
77bc948
d4636ae
42b9817
e932b99
42c5432
b1a2675
59c1329
f4b4aac
010fb7c
33579ac
1f574db
59224a0
abc66de
50d1cfe
91e6823
c32a936
6aa0985
cc13e11
a6b1cab
d2dde83
f686b73
cee9834
e564aff
83d2b39
c498b05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,6 +117,8 @@ | |
EXCEPTION_DENYLIST = ( | ||
"./source/common/http/http2/codec_impl.h", "./source/common/http/http2/codec_impl.cc") | ||
|
||
# Files that are allowed to use try without main thread assertion. | ||
# TODO(chaoqin-li1123): remove try catch pattern in dns_impl.cc. | ||
RAW_TRY_ALLOWLIST = ( | ||
"./source/common/common/regex.cc", "./source/common/common/thread.h", | ||
"./source/common/network/utility.cc", "./source/common/network/dns_impl.cc") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I have a slight preference for leaving dns_impl.cc out of this try-allowlist and the TRY_NEEDS_AUDIT there as I think there may be a path forward to fix the issue with the fuzz test. In any case there is a TODO there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We already left comment and TODO in dns_impl.cc, explaining why we can't add main thread assertion to the try block there.(Because a filter reuse that code in worker thread.) As long as we don't care about that filter, there is no security issue to fix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I know it works, what you have. But what I makes me uncomfortable is that you are allow-listing a large file. 2 reasons not to love that:
So I think TRY_NEEDS_AUDIT in this one case is a better state to leave the system in. And hopefully we can address this by cleaning up the fuzz test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. makes sense.
chaoqin-li1123 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add ASSERT(!isMainThread)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean ASSERT(isMainThread)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this is also called in worker thread. We can use OrDie version in worker thread everywhere, but that would change the behavior of envoy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry, yes. I meant ASSERT(isMainThread()). We should only be calling something that can throw if we are in the main thread, right?
Now, if this is used in worker thread, it should be a version that cannot throw, rather than this one. That's the main point of this change, right? We may have to propagate errors up stack and change some call-sites.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, comment added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'm missing something here, but it seems we're not improving anything if we're still either throwing or dying on the working thread?
Can you maybe explain the context of this PR so I can understand scope better. I.e. what's the long term game plan here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a lot less throwing and catching done in worker threads now. The only exception I think is the catch in place needed to deal with unexpected issues in the fuzz test.