Skip to content
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] spillable partition sort sink use-after-free #36223

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

stdpain
Copy link
Contributor

@stdpain stdpain commented Dec 1, 2023

Why I'm doing:
when call PartitionSortSink::close, the _chunks_sorter will be reset to null. when spill call ball called. it may cause a NPE

What I'm doing:
capture the chunks_sort in callback function

Fix stack :

*** Aborted at 1700718528 (unix time) try "date -d @1700718528" if you are using GNU date ***
PC: @          0x36106b2 _ZNSt17_Function_handlerIFN9starrocks6StatusEvEZZNS0_8pipeline34SpillablePartitionSortSinkOperator13set_finishingEPNS0_12RuntimeStateEENKUlS6_T_E0_clISt10shared_ptrINS0_5spill14IOTaskExecutorEEEEDaS6_S7_EUlvE_E9_M_invokeERKSt9_Any_data
*** SIGSEGV (@0x0) received by PID 114639 (TID 0x7fadddc59700) from PID 0; stack trace: ***
    @          0x6641b82 google::(anonymous namespace)::FailureSignalHandler()
    @     0x7faeae4ec630 (unknown)
    @          0x36106b2 _ZNSt17_Function_handlerIFN9starrocks6StatusEvEZZNS0_8pipeline34SpillablePartitionSortSinkOperator13set_finishingEPNS0_12RuntimeStateEENKUlS6_T_E0_clISt10shared_ptrINS0_5spill14IOTaskExecutorEEEEDaS6_S7_EUlvE_E9_M_invokeERKSt9_Any_data
    @          0x35de057 _ZNSt17_Function_handlerIFN9starrocks6StatusEvEZNS0_5spill7Spiller23set_flush_all_call_backINS3_23ResourceMemTrackerGuardIJSt8weak_ptrINS0_8pipeline12QueryContextEEEEEEES1_RKSt8functionIS2_EPNS0_12RuntimeStateERNS3_14IOTaskExecutorERKT_EUlvE_E9_M_invokeERKSt9_Any_data
    @          0x3675d25 starrocks::spill::SpillerWriter::_decrease_running_flush_tasks()
    @          0x35d57cb _ZZZN9starrocks5spill16RawSpillerWriter5flushIRNS0_14IOTaskExecutorERNS0_23ResourceMemTrackerGuardIJSt8weak_ptrINS_8pipeline12QueryContextEEEEEEENS_6StatusEPNS_12RuntimeStateEOT_OT0_ENKUlvE0_clEvENKUlvE0_clEv
    @          0x35d5b55 _ZNSt17_Function_handlerIFvvEZN9starrocks5spill16RawSpillerWriter5flushIRNS2_14IOTaskExecutorERNS2_23ResourceMemTrackerGuardIJSt8weak_ptrINS1_8pipeline12QueryContextEEEEEEENS1_6StatusEPNS1_12RuntimeStateEOT_OT0_EUlvE0_E9_M_invokeERKSt9_Any_data
    @          0x5221fc0 starrocks::PriorityThreadPool::work_thread()
    @          0x6601547 thread_proxy
    @     0x7faeae4e4ea5 start_thread
    @     0x7faeadaffb2d __clone
    @                0x0 (unknown)

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.2
    • 3.1
    • 3.0
    • 2.5

Signed-off-by: stdpain <drfeng08@gmail.com>
Copy link

github-actions bot commented Dec 1, 2023

[FE Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

github-actions bot commented Dec 1, 2023

[BE Incremental Coverage Report]

fail : 0 / 8 (00.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 src/exec/pipeline/spill_process_channel.h 0 1 00.00% [91]
🔵 src/exec/pipeline/sort/spillable_partition_sort_sink_operator.cpp 0 7 00.00% [72, 73, 74, 76, 79, 80, 81]

@stdpain stdpain enabled auto-merge (squash) December 1, 2023 06:05
@stdpain stdpain merged commit cab91e3 into StarRocks:main Dec 1, 2023
38 of 39 checks passed
Copy link

github-actions bot commented Dec 1, 2023

@Mergifyio backport branch-3.2

@github-actions github-actions bot removed the 3.2 label Dec 1, 2023
Copy link

github-actions bot commented Dec 1, 2023

@Mergifyio backport branch-3.1

@github-actions github-actions bot removed the 3.1 label Dec 1, 2023
Copy link

github-actions bot commented Dec 1, 2023

@Mergifyio backport branch-3.0

Copy link
Contributor

mergify bot commented Dec 1, 2023

backport branch-3.2

✅ Backports have been created

@github-actions github-actions bot removed the 3.0 label Dec 1, 2023
Copy link
Contributor

mergify bot commented Dec 1, 2023

backport branch-3.1

✅ Backports have been created

Copy link
Contributor

mergify bot commented Dec 1, 2023

backport branch-3.0

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Dec 1, 2023
Signed-off-by: stdpain <drfeng08@gmail.com>
(cherry picked from commit cab91e3)
mergify bot pushed a commit that referenced this pull request Dec 1, 2023
Signed-off-by: stdpain <drfeng08@gmail.com>
(cherry picked from commit cab91e3)
mergify bot pushed a commit that referenced this pull request Dec 1, 2023
Signed-off-by: stdpain <drfeng08@gmail.com>
(cherry picked from commit cab91e3)
stdpain added a commit that referenced this pull request Dec 1, 2023
… (#36233)

Co-authored-by: stdpain <34912776+stdpain@users.noreply.github.com>
stdpain added a commit that referenced this pull request Dec 1, 2023
… (#36231)

Co-authored-by: stdpain <34912776+stdpain@users.noreply.github.com>
lipenglin pushed a commit to lipenglin/starrocks that referenced this pull request Dec 2, 2023
stdpain added a commit to stdpain/starrocks-2 that referenced this pull request Dec 4, 2023
introduced by StarRocks#36223

ChunksSorter->Spiller->CallBackLambda->ChunksSorter->...

Signed-off-by: stdpain <drfeng08@gmail.com>
stdpain added a commit that referenced this pull request Dec 4, 2023
… (#36232)

Co-authored-by: stdpain <34912776+stdpain@users.noreply.github.com>
dingxin-tech pushed a commit to dingxin-tech/starrocks-odps that referenced this pull request Dec 12, 2023
Signed-off-by: stdpain <drfeng08@gmail.com>
Signed-off-by: 鼎昕 <zhangdingxin.zdx@alibaba-inc.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants