-
Notifications
You must be signed in to change notification settings - Fork 5.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
[core] Fix profile_events use after move #49776
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: dayshah <dhyey2019@gmail.com>
if (export_event_write_enabled_) { | ||
WriteExportData(std::move(status_events_to_write_for_export), | ||
std::vector{profile_events_to_send}); | ||
} |
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.
reordered because this is an env variable which is false by default, so we should only copy in the rare case that a user has changed it to true
Signed-off-by: dayshah <dhyey2019@gmail.com>
wait this will still actually never work in the current state, I'm assuming nobody ever turned on export_event_write They were taking by vectors by rvalue and not actually doing moves on the shared ptrs inside. Instead what's actually hapening is that ToRpcTaskEvents and ToRpcTaskExportEvents actually move the underlying instance variables. So even if we copy the vector we're just copying the shared pointers pointing to the same objects and still moving out the underlying strings. 3 options:
|
to clarify the issue is that CreateDataToSend calls ToRpcTaskEvents on the TaskEvents inside profile_events and WriteExportData calls ToRpcTaskExportEvents also on the TaskEvents inside profile_events. And they both move the same instance variables in TaskProfileEvent |
Why are these changes needed?
Fix use after move
Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.