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

*: add defer to logs the panic reason and stack #6123

Merged
merged 5 commits into from Mar 13, 2023

Conversation

HuSharp
Copy link
Member

@HuSharp HuSharp commented Mar 9, 2023

What problem does this PR solve?

Issue Number: Ref #6099

What is changed and how does it work?

add defer logs the panic reason and stack

Check List

Tests

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

Release note

None.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 9, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • bufferflies
  • rleungx

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 do-not-merge/needs-linked-issue do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none needs-ok-to-test labels Mar 9, 2023
@ti-chi-bot
Copy link
Member

Hi @HuSharp. Thanks for your PR.

I'm waiting for a tikv member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 kubernetes/test-infra repository.

@codecov
Copy link

codecov bot commented Mar 9, 2023

Codecov Report

Patch coverage: 85.71% and project coverage change: +0.02 🎉

Comparison is base (35e2e11) 74.35% compared to head (9504eec) 74.37%.

❗ Current head 9504eec differs from pull request most recent head 22c0e31. Consider uploading reports for the commit 22c0e31 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6123      +/-   ##
==========================================
+ Coverage   74.35%   74.37%   +0.02%     
==========================================
  Files         389      389              
  Lines       38128    38134       +6     
==========================================
+ Hits        28349    28364      +15     
+ Misses       7254     7243      -11     
- Partials     2525     2527       +2     
Flag Coverage Δ
unittests 74.37% <85.71%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/gctuner/memory_limit_tuner.go 45.65% <0.00%> (-1.02%) ⬇️
pkg/mcs/tso/server/grpc_service.go 12.00% <0.00%> (-0.14%) ⬇️
pkg/mcs/tso/server/server.go 47.05% <80.00%> (+0.54%) ⬆️
pkg/cache/ttl.go 97.95% <100.00%> (+0.02%) ⬆️
pkg/election/lease.go 84.50% <100.00%> (+0.44%) ⬆️
pkg/mcs/discovery/register.go 48.97% <100.00%> (+1.06%) ⬆️
pkg/mcs/resource_manager/server/manager.go 82.20% <100.00%> (+0.44%) ⬆️
pkg/mcs/resource_manager/server/server.go 54.62% <100.00%> (+0.81%) ⬆️
pkg/schedule/region_scatterer.go 79.10% <100.00%> (+1.69%) ⬆️
pkg/systimemon/systimemon.go 100.00% <100.00%> (ø)
... and 3 more

... and 28 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

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

@bufferflies
Copy link
Contributor

/need_ok_test

@HuSharp
Copy link
Member Author

HuSharp commented Mar 9, 2023

/need_ok_test

maybe /ok-to-test

@rleungx
Copy link
Member

rleungx commented Mar 9, 2023

/ok-to-test

@HuSharp HuSharp marked this pull request as ready for review March 9, 2023 09:24
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 9, 2023
@HuSharp HuSharp changed the title *: add defer to logs the panic reason and stack *: repair PD maybe panic after scatter and add defer to logs the panic reason and stack Mar 9, 2023
@@ -121,7 +122,10 @@ func (m *Manager) Init(ctx context.Context) {
m.storage.LoadResourceGroupStates(tokenHandler)
// Start the background metrics flusher.
go m.backgroundMetricsFlush(ctx)
go m.persistLoop(ctx)
go func() {
Copy link
Member

Choose a reason for hiding this comment

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

What is the difference between backgroundMetricsFlush and persistLoop?

Copy link
Member Author

Choose a reason for hiding this comment

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

persistLoop function requires a look at the code to know that it is a goroutine and is not used anywhere else.
To avoid adding logpanic to confuse people, it was changed to this

server/server.go Outdated Show resolved Hide resolved
@HuSharp HuSharp changed the title *: repair PD maybe panic after scatter and add defer to logs the panic reason and stack *: add defer to logs the panic reason and stack Mar 9, 2023
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 11, 2023
Signed-off-by: husharp <jinhao.hu@pingcap.com>
Signed-off-by: husharp <jinhao.hu@pingcap.com>
Signed-off-by: husharp <jinhao.hu@pingcap.com>
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 13, 2023
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 13, 2023
@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 13, 2023
@HuSharp
Copy link
Member Author

HuSharp commented Mar 13, 2023

@bufferflies @rleungx can u leave a merge label? thx!

@rleungx
Copy link
Member

rleungx commented Mar 13, 2023

/merge

@ti-chi-bot
Copy link
Member

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

/run-all-tests

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: 9504eec

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 13, 2023
@ti-chi-bot
Copy link
Member

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

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.

@ti-chi-bot ti-chi-bot merged commit 5bdfa71 into tikv:master Mar 13, 2023
16 checks passed
ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Mar 13, 2023
ref tikv#6099

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.1: #6153.

ti-chi-bot pushed a commit to ti-chi-bot/pd that referenced this pull request Mar 13, 2023
ref tikv#6099

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #6154.

@HuSharp HuSharp deleted the add_log_defer branch March 13, 2023 07:15
ti-chi-bot added a commit that referenced this pull request Mar 29, 2023
ref #6099, ref #6123

add defer logs the panic reason and stack

Signed-off-by: husharp <jinhao.hu@pingcap.com>

Co-authored-by: husharp <jinhao.hu@pingcap.com>
ti-chi-bot bot added a commit that referenced this pull request May 15, 2023
ref #6099, ref #6123

add defer logs the panic reason and stack

Signed-off-by: husharp <jinhao.hu@pingcap.com>

Co-authored-by: husharp <jinhao.hu@pingcap.com>
Co-authored-by: Hu# <jinhao.hu@pingcap.com>
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
rleungx added a commit to rleungx/pd that referenced this pull request Jun 5, 2023
* fix tso inconsistent problem

Signed-off-by: Ryan Leung <rleungx@gmail.com>

* *: fix the missing log panic (tikv#6325)

close tikv#6257

Signed-off-by: Ryan Leung <rleungx@gmail.com>

* *: add defer to logs the panic reason and stack (tikv#6123)

ref tikv#6099

add defer logs the panic reason and stack

Signed-off-by: husharp <jinhao.hu@pingcap.com>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>

---------

Signed-off-by: Ryan Leung <rleungx@gmail.com>
Co-authored-by: Hu# <jinhao.hu@pingcap.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants