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

util: try to fix panic #61

Merged
merged 3 commits into from
Sep 1, 2022
Merged

util: try to fix panic #61

merged 3 commits into from
Sep 1, 2022

Conversation

xhebox
Copy link
Collaborator

@xhebox xhebox commented Aug 30, 2022

What problem does this PR solve?

Issue Number: close None

Problem Summary: I don't know how it is produced. len(xx) >= 0 is expected, thus the judgement should be true forever. Anyway, this is a try.

What is changed and how it works:

  1. EncodeEntry will not free the buffer anymore, it is left to zap logger, based on https://github.com/uber-go/zap/blob/4a895a245ab794e3ae965783843a9fbc793083bc/zapcore/core.go#L95-L100
  2. StackTrace by zap is multiline, this is not compatible with tidb format.

Check List

Tests

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

Notable changes

  • Has configuration change
  • Has HTTP API interfaces change (Don't forget to add the declarative for API)
  • Has weirctl change
  • Other user behavior changes

Release note

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

None

@xhebox xhebox requested a review from djshow832 August 30, 2022 08:53
pkg/util/cmd/encoder.go Outdated Show resolved Hide resolved
@xhebox xhebox requested a review from djshow832 August 30, 2022 09:22
xhebox added 2 commits August 31, 2022 16:59
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
return &tidbEncoder{c.EncoderConfig, 0, _pool.Get()}
}

func (c tidbEncoder) Clone() zapcore.Encoder {
return c.Clone()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return c.Clone()
return c.clone()

Are you sure it calls itself?

Copy link
Collaborator Author

@xhebox xhebox Aug 31, 2022

Choose a reason for hiding this comment

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

I should have changed this to c.clone(). Maybe I made mistakes in pull --rebase.

Co-authored-by: djshow832 <zhangming@pingcap.com>
@djshow832 djshow832 merged commit d3ebbdf into pingcap:main Sep 1, 2022
@xhebox xhebox deleted the util_1 branch September 1, 2022 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants