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 coredump when TiFlash shutdown #4272

Merged
merged 6 commits into from
Mar 15, 2022
Merged

fix coredump when TiFlash shutdown #4272

merged 6 commits into from
Mar 15, 2022

Conversation

bestwoody
Copy link
Contributor

@bestwoody bestwoody commented Mar 14, 2022

Signed-off-by: bestwoody [email protected]

What problem does this PR solve?

Issue Number: close #4262

Problem Summary:

What is changed and how it works?

Check List

Tests

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

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

Signed-off-by: bestwoody <[email protected]>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 14, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • fuzhe1989
  • windtalker

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-triage-completed labels Mar 14, 2022
@bestwoody bestwoody requested a review from windtalker March 14, 2022 19:47
@ti-chi-bot ti-chi-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 14, 2022
@bestwoody bestwoody requested a review from fuzhe1989 March 14, 2022 19:47
@windtalker
Copy link
Contributor

Could you give some explainations about why TiFlash server will coredump without this pr?

@fzhedu
Copy link
Contributor

fzhedu commented Mar 15, 2022

/run-all-tests

@bestwoody
Copy link
Contributor Author

bestwoody commented Mar 15, 2022

Could you give some explainations about why TiFlash server will coredump without this pr?

1.when cq is shutdown,responder.write/finish will call abort to cause coredump. So we need check before call responder.write/finish
2.I missed a code line state=finished in cancel when porting code from my local codebase to pr.

@sre-bot
Copy link
Collaborator

sre-bot commented Mar 15, 2022

Coverage for changed files

Filename                                                                                      Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/home/jenkins/agent/workspace/tiflash-build-common/tiflash/dbms/src/Flash/EstablishCall.h           2                 2     0.00%           2                 2     0.00%           2                 2     0.00%           0                 0         -
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                               2                 2     0.00%           2                 2     0.00%           2                 2     0.00%           0                 0         -

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16853      9456             43.89%    189607  95861        49.44%

full coverage report (for internal network access only)

@@ -649,6 +653,7 @@ class Server::FlashGrpcServerHolder

private:
Poco::Logger * log;
std::shared_ptr<bool> is_shutdown;
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to use atomic bool here?

Copy link
Contributor Author

@bestwoody bestwoody Mar 15, 2022

Choose a reason for hiding this comment

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

yes... I missed. good spot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@windtalker windtalker left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 15, 2022
@@ -627,6 +628,9 @@ class Server::FlashGrpcServerHolder

~FlashGrpcServerHolder()
{
*is_shutdown = true;
const int wait_calldata_after_shutdown_interval_ms = 500;
std::this_thread::sleep_for(std::chrono::milliseconds(wait_calldata_after_shutdown_interval_ms)); // sleep 500ms to let operations of calldata called by MPPTunnel done.
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not stable, we can refine it later.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 15, 2022
@bestwoody
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

@bestwoody: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 176c5e9

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 15, 2022
@sre-bot
Copy link
Collaborator

sre-bot commented Mar 15, 2022

Coverage for changed files

Filename                                Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Flash/EstablishCall.h                         2                 2     0.00%           2                 2     0.00%           2                 2     0.00%           0                 0         -
Flash/Mpp/MPPTask.cpp                       395               395     0.00%          20                20     0.00%         328               328     0.00%         176               176     0.00%
Flash/Mpp/MPPTask.h                           3                 3     0.00%           3                 3     0.00%           3                 3     0.00%           0                 0         -
Flash/Mpp/MPPTaskManager.cpp                 97                96     1.03%          11                10     9.09%         173               172     0.58%          70                70     0.00%
Flash/Mpp/MPPTaskManager.h                    1                 0   100.00%           1                 0   100.00%           1                 0   100.00%           0                 0         -
Flash/Mpp/MPPTunnel.cpp                     175               175     0.00%          16                16     0.00%         233               233     0.00%          90                90     0.00%
Flash/Mpp/MinTSOScheduler.cpp               228               213     6.58%           7                 6    14.29%         145               135     6.90%         132               127     3.79%
Flash/Mpp/MinTSOScheduler.h                   4                 1    75.00%           2                 0   100.00%           4                 0   100.00%           4                 3    25.00%
Interpreters/Settings.h                       1                 0   100.00%           1                 0   100.00%           1                 0   100.00%           0                 0         -
Storages/StorageDeltaMerge.cpp              669               360    46.19%          56                29    48.21%        1292               762    41.02%         378               259    31.48%
Storages/Transaction/TMTContext.cpp          53                37    30.19%          34                19    44.12%         149               102    31.54%          12                11     8.33%
Storages/Transaction/TMTContext.h             4                 3    25.00%           4                 3    25.00%           4                 3    25.00%           0                 0         -
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                      1632              1285    21.26%         157               108    31.21%        2335              1740    25.48%         862               736    14.62%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16922      9502             43.85%    190607  96466        49.39%

full coverage report (for internal network access only)

@ti-chi-bot
Copy link
Member

@bestwoody: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@sre-bot
Copy link
Collaborator

sre-bot commented Mar 15, 2022

Coverage for changed files

Filename                                                     Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Flash/EstablishCall.h                                              2                 2     0.00%           2                 2     0.00%           2                 2     0.00%           0                 0         -
Flash/Mpp/MPPTask.cpp                                            395               395     0.00%          20                20     0.00%         328               328     0.00%         176               176     0.00%
Flash/Mpp/MPPTask.h                                                3                 3     0.00%           3                 3     0.00%           3                 3     0.00%           0                 0         -
Flash/Mpp/MPPTaskManager.cpp                                      97                96     1.03%          11                10     9.09%         173               172     0.58%          70                70     0.00%
Flash/Mpp/MPPTaskManager.h                                         1                 0   100.00%           1                 0   100.00%           1                 0   100.00%           0                 0         -
Flash/Mpp/MPPTunnel.cpp                                          175               175     0.00%          16                16     0.00%         233               233     0.00%          90                90     0.00%
Flash/Mpp/MinTSOScheduler.cpp                                    228               213     6.58%           7                 6    14.29%         145               135     6.90%         132               127     3.79%
Flash/Mpp/MinTSOScheduler.h                                        4                 1    75.00%           2                 0   100.00%           4                 0   100.00%           4                 3    25.00%
Interpreters/Settings.h                                            1                 0   100.00%           1                 0   100.00%           1                 0   100.00%           0                 0         -
Storages/DeltaMerge/Delta/ColumnFileFlushTask.cpp                 32                 2    93.75%           3                 0   100.00%          59                 5    91.53%          20                 2    90.00%
Storages/DeltaMerge/tests/gtest_dm_delta_merge_store.cpp        6008              1604    73.30%          37                 1    97.30%        2712                93    96.57%        2002               886    55.74%
Storages/StorageDeltaMerge.cpp                                   669               360    46.19%          56                29    48.21%        1292               762    41.02%         378               259    31.48%
Storages/Transaction/TMTContext.cpp                               53                37    30.19%          34                19    44.12%         149               102    31.54%          12                11     8.33%
Storages/Transaction/TMTContext.h                                  4                 3    25.00%           4                 3    25.00%           4                 3    25.00%           0                 0         -
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                           7672              2891    62.32%         197               109    44.67%        5106              1838    64.00%        2884              1624    43.69%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16923      9504             43.84%    190671  96479        49.40%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot merged commit 3aefd55 into pingcap:master Mar 15, 2022
JaySon-Huang pushed a commit to JaySon-Huang/tiflash that referenced this pull request Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tiflash produce core file when tiup restart tiflash node
6 participants