Skip to content

rds: workaround for the use-after-free crash.#3957

Closed
PiotrSikora wants to merge 2 commits intoenvoyproxy:masterfrom
PiotrSikora:rds_crash
Closed

rds: workaround for the use-after-free crash.#3957
PiotrSikora wants to merge 2 commits intoenvoyproxy:masterfrom
PiotrSikora:rds_crash

Conversation

@PiotrSikora
Copy link
Copy Markdown
Contributor

This doesn't fix the underlying issue (that factory_context_ is being
referenced after being freed), but it stops Envoy from crashing.

Risk Level: Low
Testing: bazel test //test/... (new test crashing without this patch)
Docs Changes: n/a
Release Notes: n/a

Workaround for #3953.

Signed-off-by: Piotr Sikora piotrsikora@google.com

This doesn't fix the underlying issue (that factory_context_ is being
referenced after being freed), but it stops Envoy from crashing.

*Risk Level*: Low
*Testing*: bazel test //test/... (new test crashing without this patch)
*Docs Changes*: n/a
*Release Notes*: n/a

Workaround for envoyproxy#3953.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
@PiotrSikora
Copy link
Copy Markdown
Contributor Author

"2");
test_server_->waitForCounterGe("listener_manager.listener_create_success", 2);

// Update existing RDS (no changes).
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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right... I could swear that I tested this locally before, but it's indeed crashing there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Test added.

void RdsRouteConfigProviderImpl::onConfigUpdate(const ResourceVector& resources,
const std::string& version_info) {
last_updated_ = factory_context_.systemTimeSource().currentTime();
last_updated_ = ProdSystemTimeSource::instance_.currentTime();
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.

Have a TimeSource& as member variable would be slightly better.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I need to mock it for the //test/common/router:rds_impl_test anyway.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
@PiotrSikora
Copy link
Copy Markdown
Contributor Author

Closing this, since @lizan is close having a proper fix

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