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

fix(tianmu): hotfix corruption in ValueOrNull under multi-thread #1869

Merged
merged 1 commit into from
Jun 28, 2023
Merged

fix(tianmu): hotfix corruption in ValueOrNull under multi-thread #1869

merged 1 commit into from
Jun 28, 2023

Conversation

RingsC
Copy link
Contributor

@RingsC RingsC commented Jun 9, 2023

Summary about this PR

In multi-thread aggregation, ExpressionColumn will occur double free due to without protection. Thread A will do ValueOrNull::operator ==, but in thread B, it will try to free it. Therefore, it leads to instance crash.

Issue Number: close #1855

Tests Check List

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Changelog

  • New Feature
  • Bug Fix
  • Performance Improvement
  • Build/Testing/CI/CD
  • Documentation
  • Not for changelog (changelog entry is not required)

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features

@mergify
Copy link
Contributor

mergify bot commented Jun 9, 2023

Thanks for the contribution!
I have applied any labels matching special text in your PR Changelog.

Please review the labels and make any necessary changes.

@mergify mergify bot added the PR-bug bug for pull request label Jun 9, 2023
@RingsC RingsC marked this pull request as ready for review June 20, 2023 09:49
@codecov
Copy link

codecov bot commented Jun 20, 2023

Codecov Report

Patch coverage: 63.63% and project coverage change: -5.00 ⚠️

Comparison is base (7d03695) 60.25% compared to head (99bb989) 55.25%.

❗ Current head 99bb989 differs from pull request most recent head c3a35ac. Consider uploading reports for the commit c3a35ac to get more accurate results

Additional details and impacted files
@@                 Coverage Diff                 @@
##           stonedb-5.7-dev    #1869      +/-   ##
===================================================
- Coverage            60.25%   55.25%   -5.00%     
===================================================
  Files                 1837     2031     +194     
  Lines               380678   431538   +50860     
===================================================
+ Hits                229371   238461    +9090     
- Misses              151307   193077   +41770     
Impacted Files Coverage Δ
storage/tianmu/handler/ha_tianmu.cpp 51.54% <ø> (ø)
storage/tianmu/optimizer/aggregation_algorithm.cpp 73.25% <ø> (+16.96%) ⬆️
storage/tianmu/optimizer/aggregator_basic.h 63.45% <ø> (+1.69%) ⬆️
storage/tianmu/optimizer/group_table.cpp 78.36% <0.00%> (+10.02%) ⬆️
storage/tianmu/vc/column_share.h 100.00% <ø> (ø)
storage/tianmu/vc/expr_column.cpp 70.19% <ø> (ø)
storage/tianmu/optimizer/aggregator_basic.cpp 32.49% <40.00%> (+<0.01%) ⬆️
storage/tianmu/core/value_or_null.cpp 68.11% <100.00%> (+0.51%) ⬆️
storage/tianmu/core/value_or_null.h 89.74% <100.00%> (+0.26%) ⬆️

... and 269 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@RingsC RingsC requested a review from haitaoguan June 20, 2023 11:04
@RingsC RingsC requested a review from davidshiz June 26, 2023 12:29
Copy link

@zhongshengstoneatom zhongshengstoneatom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

In multi-thread aggregation, ExpressionColumn will occur double free due to without
protection. Thread A will do ValueOrNull::operator ==, but in thread B, it will try to
free it. Therefore, it leads to instance crash.
@mergify mergify bot merged commit 60a8cf7 into stoneatom:stonedb-5.7-dev Jun 28, 2023
6 of 7 checks passed
@RingsC RingsC deleted the hotfix-issue1855-double-free-in-multithread branch June 28, 2023 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-bug bug for pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: The instance is crashed if the aggregate function out of bounds
4 participants