-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Bug] fix mem_tracker use-after-free & add UT for it #3899
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
[Bug] fix mem_tracker use-after-free & add UT for it #3899
Conversation
|
The detected error: report about heap-use-after-free address: It's The root cause is, RowBatch in NodeChannel use the deleted tracker parent(state->instance_mem_tracker()). |
|
The patch am not very understand. You meaning is _cur_batch and _pending_batches is not emtpy when destructor? So you clear_all_batches when destructor. @vagetablechicken |
Yes, we should clear _cur_batch and _pending_batches before NodeChannel's destruction.( |
I understand. I have on problem |
…if alter version < 2 apache#49062 (apache#49921) (apache#3899) Cherry-picked from apache#49062 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
If NodeChannel is internal cancelled, it may has some bytes in
_cur_batchor_pending_batches. And it's possible that we close theseinternal cancelledNodeChannels bymark_close()&close(), cuz the OlapTableSink may be succeed and closed withStatus::OK().TEST_F(OlapTableSinkTest, add_batch_failed), make ObjectPool created before RuntimeState, make NodeChannels hasnot emptybatches, to simulate this scenario.use-after-freeerrors.Incidentally, fix bugs reported by ASAN/LSAN.