-
Notifications
You must be signed in to change notification settings - Fork 593
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
cloud_roles: Fix metrics lifetime #11155
cloud_roles: Fix metrics lifetime #11155
Conversation
Limit the lifetime of the metrics to the async lifetime of `refresh_credentials`. Fixes redpanda-data#11095 Fixes redpanda-data#11107 Signed-off-by: Ben Pope <ben@redpanda.com>
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.
LGTM, I am going to do some tests to see if this issue exists on 23.1 or not as well.
No occurrences on v23.1.x in the last 14d / 55 runs. |
CI failures exist outside of this PR:
(still waiting for unit tests to complete - they're taking longer than usual) |
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.
lgtm
Okay so I tracked this down and it's due to the move constructor being invoked on the probe here This causes the I'm going to post a note to the team about probe lifetimes and then also do a pass of disabling the move constructors for probes and see what breaks. AFAIK this bug has always been there, but maybe clang's sanitizers only got good enough to recognize it after the clang16 upgrade? |
Probes register metrics by capturing `this`, and it's not save to move them after that. In a lot of places this is safe because their lifetime is directly tied to a service which lives the whole program's lifetime, but any small move of that object even during initialization can break things (see redpanda-data#11155, redpanda-data#11095, redpanda-data#11107). This takes a big hammer approach to removing this foot gun by making all probes immovable and wrapping them in `std::unique_ptr`. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Probes register metrics by capturing `this`, and it's not save to move them after that. In a lot of places this is safe because their lifetime is directly tied to a service which lives the whole program's lifetime, but any small move of that object even during initialization can break things (see redpanda-data#11155, redpanda-data#11095, redpanda-data#11107). This takes a big hammer approach to removing this foot gun by making all probes immovable and wrapping them in `std::unique_ptr`. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Probes register metrics by capturing `this`, and it's not save to move them after that. In a lot of places this is safe because their lifetime is directly tied to a service which lives the whole program's lifetime, but any small move of that object even during initialization can break things (see redpanda-data#11155, redpanda-data#11095, redpanda-data#11107). This takes a big hammer approach to removing this foot gun by making all probes immovable and wrapping them in `std::unique_ptr`. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Thanks @rockwotj good idea
Yeh I think that is a reasonable hypothesis. |
Probes register metrics by capturing `this`, and it's not save to move them after that. In a lot of places this is safe because their lifetime is directly tied to a service which lives the whole program's lifetime, but any small move of that object even during initialization can break things (see redpanda-data#11155, redpanda-data#11095, redpanda-data#11107). This takes a big hammer approach to removing this foot gun by making all probes immovable and wrapping them in `std::unique_ptr`. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Thank you, gentlemen! |
Probes register metrics by capturing `this`, and it's not save to move them after that. In a lot of places this is safe because their lifetime is directly tied to a service which lives the whole program's lifetime, but any small move of that object even during initialization can break things (see redpanda-data#11155, redpanda-data#11095, redpanda-data#11107). This takes a big hammer approach to removing this foot gun by making all probes immovable and wrapping them in `std::unique_ptr`. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Probes register metrics by capturing `this`, and it's not save to move them after that. In a lot of places this is safe because their lifetime is directly tied to a service which lives the whole program's lifetime, but any small move of that object even during initialization can break things (see redpanda-data#11155, redpanda-data#11095, redpanda-data#11107). This takes a big hammer approach to removing this foot gun by making all probes immovable and wrapping them in `std::unique_ptr`. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Probes register metrics by capturing `this`, and it's not save to move them after that. In a lot of places this is safe because their lifetime is directly tied to a service which lives the whole program's lifetime, but any small move of that object even during initialization can break things (see redpanda-data#11155, redpanda-data#11095, redpanda-data#11107). This takes a big hammer approach to removing this foot gun by making all probes immovable and wrapping them in `std::unique_ptr`. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Probes register metrics by capturing `this`, and it's not save to move them after that. In a lot of places this is safe because their lifetime is directly tied to a service which lives the whole program's lifetime, but any small move of that object even during initialization can break things (see redpanda-data#11155, redpanda-data#11095, redpanda-data#11107). This takes a big hammer approach to removing this foot gun by making all probes immovable and wrapping them in `std::unique_ptr`. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Probes register metrics by capturing `this`, and it's not save to move them after that. In a lot of places this is safe because their lifetime is directly tied to a service which lives the whole program's lifetime, but any small move of that object even during initialization can break things (see redpanda-data#11155, redpanda-data#11095, redpanda-data#11107). This takes a big hammer approach to removing this foot gun by making all probes immovable and wrapping them in `std::unique_ptr`. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Limit the lifetime of the metrics to the async lifetime of
refresh_credentials
.Fixes #11095
Fixes #11107
Backports Required
No occurrences on v23.1.x in the last 14d / 55 runs.
Release Notes