-
Notifications
You must be signed in to change notification settings - Fork 5k
[tcp_proxy] Add nullptr checks to watermark asserts #40034
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
Conversation
Signed-off-by: Kateryna Nezdolii <kateryna.nezdolii@gmail.com>
cc @jrajahalme |
source/common/tcp_proxy/tcp_proxy.cc
Outdated
@@ -437,7 +437,8 @@ void Filter::UpstreamCallbacks::onEvent(Network::ConnectionEvent event) { | |||
|
|||
void Filter::UpstreamCallbacks::onAboveWriteBufferHighWatermark() { | |||
// TCP Tunneling may call on high/low watermark multiple times. | |||
ASSERT(parent_->config_->tunnelingConfigHelper() || !on_high_watermark_called_); | |||
ASSERT((parent_ != nullptr && parent_->config_->tunnelingConfigHelper()) || |
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.
in the case when we enter draining state parent_
will be set to nullptr. In draining state if code invokes this callback is will trigger ASSERT failure in non release mode. @ggreenway would this be correct logic to assert fail if callback is invoked in draining state? or should we instead have ASSERT statement like:
ASSERT(parent == nullptr || parent_->config_->tunnelingConfigHelper() || !on_high_watermark_called_);
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.
Yeah, I think what you wrote in the comment is correct. Please also add a comment explaining the draining case. It looks like the two ASSERTs were the only places using parent_
without checking it for nullptr
.
Signed-off-by: Kateryna Nezdolii <kateryna.nezdolii@gmail.com>
/retest |
Verify examples ci step fails with
cc @phlax |
Commit Message: Add nullptr checks into watermark asserts in tcp proxy to avoid potential segfaults.
Additional Description:
Risk Level: Low
Testing:
Docs Changes:
Release Notes:
Platform Specific Features: