-
Notifications
You must be signed in to change notification settings - Fork 874
Fix lsan error on Aggregator #22011
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
Fix lsan error on Aggregator #22011
Conversation
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on October 28. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
…memory and erase inline values
mpoeter
left a comment
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!
…regator-lsan + // Use "test_" in dev; set to "" in production.
mchacki
left a comment
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
Scope & Purpose
This PR fixes the following error on circle ci nightly for devel:
When a query uses aggregators AggregatorMin and AggregatorMax, and the next AqlValue that is parsed is reduced, a deep copy of this AqlValue is made and the old one is tossed out. When the query aborted, the newly allocated value wasn't being cleared out, hence, lsan complained about a memory leak.
This PR fixes it by changing the AggregatorMin and AggregatorMax
reset()methods fromvalue.erase()tovalue.destroy(). Just usingvalue.erase()wouldn't properly reset the value, because it just zeroes out the AqlValue stored in the object without properly freeing its memory. The methoddestroy()does it all for memory managed values, anderase()just for inline values.Also, for safety, it also changes the memory accounting in
reduce()to precharge the ResourceUsageScope before any memory deallocation is made. This avoids a breach in between the two previous lines that decreased and then increased the usage scope, and also, asincrease()can throw, the fix avoids it from throwing an exception after the memory deallocation is made indestroy().Checklist
Related Information
(Please reference tickets / specification / other PRs etc)