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

operator: print callstack when exiting before preparing done #51371

Merged
merged 5 commits into from
Mar 6, 2024

Conversation

YuJuncen
Copy link
Contributor

@YuJuncen YuJuncen commented Feb 27, 2024

What problem does this PR solve?

Issue Number: close #51370

Problem Summary:
It is hard to debug what happens when the init pod get timed out.

What changed and how does it work?

This PR will print all gorouintes to stdout once the prepare-for-snapshot-backup command exits before finishing the full prepare stage.

Check List

Tests

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

When we are not yet finished:
CleanShot 2024-02-27 at 19 28 14@2x
When we have finished prepare stage:
CleanShot 2024-02-27 at 19 28 51@2x

  • No need to test
    • I checked and no code files have been changed.

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

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added 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. labels Feb 27, 2024
Copy link

tiprow bot commented Feb 27, 2024

Hi @YuJuncen. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

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.

Signed-off-by: Yu Juncen <[email protected]>
Copy link

codecov bot commented Feb 27, 2024

Codecov Report

Attention: Patch coverage is 40.90909% with 26 lines in your changes missing coverage. Please review.

Project coverage is 73.0579%. Comparing base (15a8459) to head (84f6513).
Report is 1950 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #51371        +/-   ##
================================================
+ Coverage   70.6430%   73.0579%   +2.4149%     
================================================
  Files          1459       1465         +6     
  Lines        434200     453774     +19574     
================================================
+ Hits         306732     331518     +24786     
+ Misses       108243     101896      -6347     
- Partials      19225      20360      +1135     
Flag Coverage Δ
integration 49.0359% <9.3023%> (?)
unit 70.6749% <36.3636%> (+0.2453%) ⬆️

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

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 50.5688% <40.9090%> (+4.6943%) ⬆️

func StartExitSingleListener(ctx context.Context) (context.Context, context.CancelFunc) {
cx, cancel := context.WithCancel(ctx)
sc := make(chan os.Signal, 1)
signal.Notify(sc,
Copy link
Contributor

Choose a reason for hiding this comment

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

To confirm, will a normal init job exit print the go routines also?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, goroutine dump won't be printed once prepare done.

@BornChanger
Copy link
Contributor

/cc @WangLe1321 ptal.

fmt.Println()
printDelimate(fmt.Sprintf("Got signal %v to exit.", sig))
printDelimate(fmt.Sprintf("Required Goroutine Dump = %v", dumpGoroutine))
if DumpGoroutineWhenExit.Load() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just use dumpGoroutine?

printDelimate(fmt.Sprintf("Required Goroutine Dump = %v", dumpGoroutine))
if DumpGoroutineWhenExit.Load() {
printDelimate("Start Dumping Goroutine")
os.Stdout.Write(AllStackInfo())
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use fmt.Println(AllStackInfo())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

debug.PrintStack() uses write. I think there isn't many difference between them.

Signed-off-by: Yu Juncen <[email protected]>
Signed-off-by: Yu Juncen <[email protected]>
Copy link

ti-chi-bot bot commented Mar 6, 2024

@WangLe1321: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

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.

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Mar 6, 2024
Copy link
Contributor

@3pointer 3pointer left a comment

Choose a reason for hiding this comment

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

rest LGTM

@@ -141,6 +142,7 @@ func AdaptEnvForSnapshotBackup(ctx context.Context, cfg *PauseGcConfig) error {
if cfg.OnAllReady != nil {
cfg.OnAllReady()
}
utils.DumpGoroutineWhenExit.Store(false)
Copy link
Contributor

Choose a reason for hiding this comment

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

it seems no need set it back

Copy link

ti-chi-bot bot commented Mar 6, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 3pointer, BornChanger, WangLe1321

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Mar 6, 2024
Copy link

ti-chi-bot bot commented Mar 6, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-03-06 03:38:34.839954412 +0000 UTC m=+224741.862200799: ☑️ agreed by BornChanger.
  • 2024-03-06 08:36:36.71644493 +0000 UTC m=+242623.738691318: ☑️ agreed by 3pointer.

Copy link

tiprow bot commented Mar 6, 2024

@YuJuncen: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
tidb_parser_test 84f6513 link true /test tidb_parser_test

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@BornChanger
Copy link
Contributor

/retest

Copy link

tiprow bot commented Mar 6, 2024

@BornChanger: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@ti-chi-bot ti-chi-bot bot merged commit ff794e5 into pingcap:master Mar 6, 2024
32 of 34 checks passed
@YuJuncen
Copy link
Contributor Author

YuJuncen commented Mar 6, 2024

/run-cherry-picker

@YuJuncen YuJuncen added the needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. label Mar 6, 2024
@YuJuncen
Copy link
Contributor Author

YuJuncen commented Mar 6, 2024

/run-cherry-picker

@ti-chi-bot
Copy link
Member

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

mittalrishabh pushed a commit to mittalrishabh/tidb that referenced this pull request May 6, 2024
mittalrishabh pushed a commit to mittalrishabh/tidb that referenced this pull request May 30, 2024
@BornChanger BornChanger added needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. labels Nov 3, 2024
@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 3, 2024
@ti-chi-bot ti-chi-bot bot removed the needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

disk_snapshot_backup: print more debug info when the init pod get interrupted
5 participants