-
Notifications
You must be signed in to change notification settings - Fork 1.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
[BugFix] Fix transaction stream load lock leak #53564
Conversation
Signed-off-by: PengFei Li <[email protected]>
96cae2e
to
1493631
Compare
} | ||
|
||
void TransactionStreamLoadAction::free_handler_ctx(void* param) { | ||
StreamLoadContext* ctx = (StreamLoadContext*)param; |
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.
static_cast?
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.
fixed
|
||
void TransactionStreamLoadAction::free_handler_ctx(void* param) { | ||
StreamLoadContext* ctx = (StreamLoadContext*)param; | ||
if (ctx == nullptr) { |
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.
shall check nullptr against param
before convert to StreamLoadContext?
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.
static_cast can be applied to nullptr so it's safe to check after the cast
Signed-off-by: PengFei Li <[email protected]>
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[BE Incremental Coverage Report]✅ pass : 16 / 19 (84.21%) file detail
|
@Mergifyio backport branch-3.4 |
@Mergifyio backport branch-3.3 |
@Mergifyio backport branch-3.2 |
✅ Backports have been created
|
@Mergifyio backport branch-3.1 |
✅ Backports have been created
|
Signed-off-by: PengFei Li <[email protected]> (cherry picked from commit 82fffc3)
Signed-off-by: PengFei Li <[email protected]> (cherry picked from commit 82fffc3) # Conflicts: # be/test/http/transaction_stream_load_test.cpp
Signed-off-by: PengFei Li <[email protected]> (cherry picked from commit 82fffc3) # Conflicts: # be/test/http/transaction_stream_load_test.cpp
ignore backport check: 3.1.16 |
Signed-off-by: PengFei Li <[email protected]>
Signed-off-by: PengFei Li <[email protected]>
Signed-off-by: PengFei Li <[email protected]>
Signed-off-by: PengFei Li <[email protected]>
) Co-authored-by: PengFei Li <[email protected]>
) Signed-off-by: PengFei Li <[email protected]> Co-authored-by: PengFei Li <[email protected]>
) Signed-off-by: PengFei Li <[email protected]>
) Signed-off-by: PengFei Li <[email protected]>
Why I'm doing:
In transaction stream load, a normal load request needs to go through the
on_header
,on_chunk_data
, andhandle
processes of theTransactionStreamLoadAction
. To prevent concurrent load requests, a lock will be acquired inon_header
, and released inhandle
. But for an abnormal load request,handle
may be not called, and the lock will not be released. For example, the client crashes before transmitting all of data, onlyon_header
andon_chunk_data
are called, andhandle
will not be called. This can lead to resources not being cleaned up after the load timeout because the cleanup needs acquire the lock (see TransactionMgr::_clean_stream_context).What I'm doing:
Move the lock release to
TransactionStreamLoadAction::free_handler_ctx
which will be always called regardless of whether an exception occurs or not.Fixes #53155
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: