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] Do not reuse input null and offset column for array_map (backport #44226) #44274

Closed
wants to merge 1 commit into from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Apr 17, 2024

Why I'm doing:

Release version crashed stack:

*** SIGSEGV (@0x7f24ad5f1000) received by PID 3321687 (TID 0x7f238c7d2640) from PID 18446744072323272704; stack trace: ***
    @          0x8b27baa google::(anonymous namespace)::FailureSignalHandler()
    @     0x7f24cb60e520 (unknown)
    @          0x7ab83a8 starrocks::MysqlRowBuffer::push_string()
    @          0x490d4ac starrocks::ArrayColumn::put_mysql_row_buffer()
    @          0x78f854a starrocks::MysqlResultWriter::process_chunk()
    @          0x50e2e17 starrocks::pipeline::ResultSinkOperator::push_chunk()
    @          0x51ac9d7 starrocks::pipeline::PipelineDriver::process()
    @          0x519aa58 starrocks::pipeline::GlobalDriverExecutor::_worker_thread()
    @          0x7aeedb1 starrocks::ThreadPool::dispatch_thread()
    @          0x7ae9c1f starrocks::Thread::supervise_thread()
    @     0x7f24cb660ac3 (unknown)
    @     0x7f24cb6f2850 (unknown)
    @                0x0 (unknown)

ASAN version crashed stack:

    @          0xb5030a2 starrocks::failure_function()
    @         0x182830bd google::LogMessage::Fail()
    @         0x1828552f google::LogMessage::SendToLog()
    @         0x18282c0e google::LogMessage::Flush()
    @         0x18285b39 google::LogMessageFatal::~LogMessageFatal()
    @          0xcfcf42b starrocks::Column::filter()
    @          0xcfc96ca starrocks::Chunk::filter()
    @          0xd159bb0 starrocks::eager_prune_eval_conjuncts()
    @          0xd15a158 starrocks::ExecNode::eval_conjuncts()
    @          0xf2864a1 starrocks::HashJoiner::_process_other_conjunct()
    @          0xf299628 starrocks::HashJoiner::filter_probe_output_chunk()
    @          0xf291c3d starrocks::HashJoinProber::probe_chunk()
    @          0xf28319d starrocks::HashJoiner::_pull_probe_output_chunk()
    @          0xf282d2d starrocks::HashJoiner::pull_chunk()
    @          0xe8a943a starrocks::pipeline::HashJoinProbeOperator::pull_chunk()
    @          0xe7015d9 starrocks::pipeline::PipelineDriver::process()
    @          0xe6c1f10 starrocks::pipeline::GlobalDriverExecutor::_worker_thread()
    @          0xe6c0934 _ZZN9starrocks8pipeline20GlobalDriverExecutor10initializeEiENKUlvE_clEv
    @          0xe6cc8fc _ZSt13__invoke_implIvRZN9starrocks8pipeline20GlobalDriverExecutor10initializeEiEUlvE_JEET_St14__invoke_otherOT0_DpOT1_
    @          0xe6cbc01 _ZSt10__invoke_rIvRZN9starrocks8pipeline20GlobalDriverExecutor10initializeEiEUlvE_JEENSt9enable_ifIX16is_invocable_r_vIT_T0_DpT1_EES6_E4typeEOS7_DpOS8_
    @          0xe6cac9b _ZNSt17_Function_handlerIFvvEZN9starrocks8pipeline20GlobalDriverExecutor10initializeEiEUlvE_E9_M_invokeERKSt9_Any_data
    @          0xb3f082c std::function<>::operator()()
    @          0xbf40ef0 starrocks::FunctionRunnable::run()
    @          0xbf3d3f5 starrocks::ThreadPool::dispatch_thread()
    @          0xbf5a5e8 std::__invoke_impl<>()
    @          0xbf5a0d3 std::__invoke<>()
    @          0xbf5901c _ZNSt5_BindIFMN9starrocks10ThreadPoolEFvvEPS1_EE6__callIvJEJLm0EEEET_OSt5tupleIJDpT0_EESt12_Index_tupleIJXspT1_EEE

What I'm doing:

ArrayMapExpr's returned array column reuses null and offset column from the input column.
As a result, two array columns in a chunk have the same null and offset column.

This is dangerous. For example, when filtering this chunk, the first array column will resize null and offset column, and the second array column will visit the resized part of null and offset column.

Fixes #issue

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
  • This is a backport pr

Bugfix cherry-pick branch check:

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

This is an automatic backport of pull request #44226 done by [Mergify](https://mergify.com). ## Why I'm doing:

Release version crashed stack:

*** SIGSEGV (@0x7f24ad5f1000) received by PID 3321687 (TID 0x7f238c7d2640) from PID 18446744072323272704; stack trace: ***
    @          0x8b27baa google::(anonymous namespace)::FailureSignalHandler()
    @     0x7f24cb60e520 (unknown)
    @          0x7ab83a8 starrocks::MysqlRowBuffer::push_string()
    @          0x490d4ac starrocks::ArrayColumn::put_mysql_row_buffer()
    @          0x78f854a starrocks::MysqlResultWriter::process_chunk()
    @          0x50e2e17 starrocks::pipeline::ResultSinkOperator::push_chunk()
    @          0x51ac9d7 starrocks::pipeline::PipelineDriver::process()
    @          0x519aa58 starrocks::pipeline::GlobalDriverExecutor::_worker_thread()
    @          0x7aeedb1 starrocks::ThreadPool::dispatch_thread()
    @          0x7ae9c1f starrocks::Thread::supervise_thread()
    @     0x7f24cb660ac3 (unknown)
    @     0x7f24cb6f2850 (unknown)
    @                0x0 (unknown)

ASAN version crashed stack:

    @          0xb5030a2 starrocks::failure_function()
    @         0x182830bd google::LogMessage::Fail()
    @         0x1828552f google::LogMessage::SendToLog()
    @         0x18282c0e google::LogMessage::Flush()
    @         0x18285b39 google::LogMessageFatal::~LogMessageFatal()
    @          0xcfcf42b starrocks::Column::filter()
    @          0xcfc96ca starrocks::Chunk::filter()
    @          0xd159bb0 starrocks::eager_prune_eval_conjuncts()
    @          0xd15a158 starrocks::ExecNode::eval_conjuncts()
    @          0xf2864a1 starrocks::HashJoiner::_process_other_conjunct()
    @          0xf299628 starrocks::HashJoiner::filter_probe_output_chunk()
    @          0xf291c3d starrocks::HashJoinProber::probe_chunk()
    @          0xf28319d starrocks::HashJoiner::_pull_probe_output_chunk()
    @          0xf282d2d starrocks::HashJoiner::pull_chunk()
    @          0xe8a943a starrocks::pipeline::HashJoinProbeOperator::pull_chunk()
    @          0xe7015d9 starrocks::pipeline::PipelineDriver::process()
    @          0xe6c1f10 starrocks::pipeline::GlobalDriverExecutor::_worker_thread()
    @          0xe6c0934 _ZZN9starrocks8pipeline20GlobalDriverExecutor10initializeEiENKUlvE_clEv
    @          0xe6cc8fc _ZSt13__invoke_implIvRZN9starrocks8pipeline20GlobalDriverExecutor10initializeEiEUlvE_JEET_St14__invoke_otherOT0_DpOT1_
    @          0xe6cbc01 _ZSt10__invoke_rIvRZN9starrocks8pipeline20GlobalDriverExecutor10initializeEiEUlvE_JEENSt9enable_ifIX16is_invocable_r_vIT_T0_DpT1_EES6_E4typeEOS7_DpOS8_
    @          0xe6cac9b _ZNSt17_Function_handlerIFvvEZN9starrocks8pipeline20GlobalDriverExecutor10initializeEiEUlvE_E9_M_invokeERKSt9_Any_data
    @          0xb3f082c std::function<>::operator()()
    @          0xbf40ef0 starrocks::FunctionRunnable::run()
    @          0xbf3d3f5 starrocks::ThreadPool::dispatch_thread()
    @          0xbf5a5e8 std::__invoke_impl<>()
    @          0xbf5a0d3 std::__invoke<>()
    @          0xbf5901c _ZNSt5_BindIFMN9starrocks10ThreadPoolEFvvEPS1_EE6__callIvJEJLm0EEEET_OSt5tupleIJDpT0_EESt12_Index_tupleIJXspT1_EEE

What I'm doing:

ArrayMapExpr's returned array column reuses null and offset column from the input column.
As a result, two array columns in a chunk have the same null and offset column.

This is dangerous. For example, when filtering this chunk, the first array column will resize null and offset column, and the second array column will visit the resized part of null and offset column.

Fixes #issue

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
  • This is a backport pr

)

Signed-off-by: zihe.liu <[email protected]>
(cherry picked from commit 70db73d)

# Conflicts:
#	be/src/exprs/vectorized/array_map_expr.cpp
Copy link
Contributor Author

mergify bot commented Apr 17, 2024

Cherry-pick of 70db73d has failed:

On branch mergify/bp/branch-2.5/pr-44226
Your branch is up to date with 'origin/branch-2.5'.

You are currently cherry-picking commit 70db73d348.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   test/sql/test_array/R/test_array_map
	new file:   test/sql/test_array/T/test_array_map

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   be/src/exprs/vectorized/array_map_expr.cpp

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Copy link
Contributor Author

mergify bot commented Apr 17, 2024

@mergify[bot]: Backport conflict, please reslove the conflict and resubmit the pr

auto-merge was automatically disabled April 17, 2024 10:48

Pull request was closed

@mergify mergify bot deleted the mergify/bp/branch-2.5/pr-44226 branch April 17, 2024 10:49
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.

1 participant