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

stats: fix panic when dumping stats #8448

merged 6 commits into from Nov 26, 2018


None yet
5 participants

lamxTyler commented Nov 26, 2018

What problem does this PR solve?

When dumping stats, we get panic log like:

... Panic: runtime error: invalid memory address or nil pointer dereference (PC=0x45B81A)

  in gopanic
  in panicmem
  in sigpanic
  in Histogram.ConvertTo
  in Histogram.ConvertTo
  in Handle.tableStatsToJSON
  in Handle.DumpStatsToJSON

What is changed and how it works?

If the column is not primary key, we will load the bucket info by need, thus leaving the Bound as nil. If the column is droped, we will not delete it immediately, so this column will still be in the cache, so when dumping the stats, we will meet panic when using the Bound info.

This PR fixes this by assigning empty chunk to Bound, so it will never be nil, and this will make future code does not meet the same problem again.

Check List


  • Unit test

Code changes

  • Has exported function/method change

Side effects

  • None

Related changes

  • Need to cherry-pick to the release branch

This change is Reviewable




This comment has been minimized.


lamxTyler commented Nov 26, 2018


@lamxTyler lamxTyler added status/LGT2 and removed status/LGT1 labels Nov 26, 2018

zz-jason added some commits Nov 26, 2018

@zz-jason zz-jason merged commit 8be09da into pingcap:master Nov 26, 2018

4 checks passed

ci/circleci Your tests passed on CircleCI!
continuous-integration/travis-ci/pr The Travis CI build passed
jenkins-ci-tidb/build Jenkins job succeeded.
license/cla Contributor License Agreement is signed.

@lamxTyler lamxTyler deleted the lamxTyler:dump-stats branch Nov 27, 2018

lamxTyler added a commit to lamxTyler/tidb that referenced this pull request Nov 27, 2018

lamxTyler added a commit to lamxTyler/tidb that referenced this pull request Nov 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment