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

Remove broken panic handler #17354

Merged

Conversation

dbussink
Copy link
Contributor

@dbussink dbussink commented Dec 9, 2024

This handler would recover any arbitrary panic and make the test pass. This is a big anti-pattern since it means we can have many failing tests we don't know about and things are silently broken potentially.

Running against CI to test the fallout of this.

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Copy link
Contributor

vitess-bot bot commented Dec 9, 2024

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Dec 9, 2024
@github-actions github-actions bot added this to the v22.0.0 milestone Dec 9, 2024
@dbussink dbussink removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Dec 9, 2024
Copy link

codecov bot commented Dec 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.46%. Comparing base (0fe256e) to head (3e175b7).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #17354   +/-   ##
=======================================
  Coverage   67.46%   67.46%           
=======================================
  Files        1581     1581           
  Lines      253934   253934           
=======================================
+ Hits       171308   171313    +5     
+ Misses      82626    82621    -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -525,7 +524,6 @@ func launchRecoveryTablet(t *testing.T, tablet *cluster.Vttablet, binlogServer *
tablet.MysqlctlProcess = *mysqlctlProcess
extraArgs := []string{"--db-credentials-file", dbCredentialFile}
tablet.MysqlctlProcess.InitDBFile = initDBFileWithPassword
tablet.VttabletProcess.DbPassword = mysqlPassword
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shlomi-noach @mattlord @rohit-nayak-ps This line was crashing this test, so we never actually ran it and it was always passing because of the now removed defer cluster.PanicHandler(nil) call. Looks like the test might now be failing, but it means it has likely been failing forever / for a really long time.

Any ideas on how to fix this?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's failing here:

func testTabletRecovery(t *testing.T, binlogServer *binLogServer, lookupTimeout, restoreKeyspaceName, shardName, expectedRows string) {
	recoveryTablet := clusterInstance.NewVttabletInstance("replica", 0, cell)
	launchRecoveryTablet(t, recoveryTablet, binlogServer, lookupTimeout, restoreKeyspaceName, shardName)

	sqlRes, err := recoveryTablet.VttabletProcess.QueryTablet(getCountID, keyspaceName, true)
	require.NoError(t, err)
	assert.Equal(t, expectedRows, sqlRes.Rows[0][0].String())

So my first guess would be that we need to wait for replication to catch up and for the expected result. Currently all it's doing is waiting for the tablet to become SERVING and then it queries it. Perhaps the tablet needs a second to replicate things. I would first just try adding a sleep of 30 seconds or something.

Copy link
Contributor

@shlomi-noach shlomi-noach Dec 10, 2024

Choose a reason for hiding this comment

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

This tests the old-and-unsupported-and-actually-legacy Google Ripple binlog server based PITR.

We should stop running this test altogether. Now is as good a time as ever.

Copy link
Contributor

Choose a reason for hiding this comment

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

@dbussink I've pushed a change to remove the test from running in shard 10. For now this should fix this PR. Later on (on a different PR) I will purge the entire codebase and tests.

Copy link
Member

@frouioui frouioui left a comment

Choose a reason for hiding this comment

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

Aren't the tests supposed to fail anyway if there is a panic? Seems like cluster.PanicHandler should make the test fail if we recover a panic since the err wouldn't be nil:

func PanicHandler(t testing.TB) {
err := recover()
if t == nil {
return
}
require.Nilf(t, err, "panic occured in testcase %v", t.Name())
}

@dbussink
Copy link
Contributor Author

dbussink commented Dec 9, 2024

Aren't the tests supposed to fail anyway if there is a panic? Seems like cluster.PanicHandler should make the test fail if we recover a panic since the err wouldn't be nil:

It doesn't. In all the cases removed here, nil is passed in for t. So that means it does the recover() and then returns without failing the test.

So hence the test passes when this is used if the test panics.

dbussink and others added 3 commits December 10, 2024 10:26
This handler would recover any arbitrary panic and make the test pass.
This is a big anti-pattern since it means we can have many failing tests
we don't know about and things are silently broken potentially.

Running against CI to test the fallout of this.

Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
This test was never running since any panic would make a test pass
before removing the recovery handler.

Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
vitessio#16673

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
When a test panics, it's way more useful to see the actual backtrace for
the panic and not try to recover anything that hides that information.

Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
@dbussink dbussink force-pushed the dbussink/remove-broken-panic-handler branch from 826c780 to 3e175b7 Compare December 10, 2024 09:27
@dbussink dbussink added Backport to: release-19.0 Needs to be back ported to release-19.0 Backport to: release-20.0 Needs to be backport to release-20.0 Backport to: release-21.0 Needs to be backport to release-21.0 labels Dec 10, 2024
@dbussink
Copy link
Contributor Author

Backporting this too since it can be hiding legitimate test failures / problems and we don't want to have those crop up in release branches either then.

@dbussink dbussink merged commit bad431d into vitessio:main Dec 10, 2024
104 checks passed
@dbussink dbussink deleted the dbussink/remove-broken-panic-handler branch December 10, 2024 09:52
dbussink added a commit that referenced this pull request Dec 10, 2024
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
dbussink added a commit that referenced this pull request Dec 10, 2024
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
dbussink added a commit that referenced this pull request Dec 10, 2024
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
dbussink added a commit that referenced this pull request Dec 10, 2024
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
dbussink added a commit that referenced this pull request Dec 10, 2024
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
dbussink added a commit that referenced this pull request Dec 10, 2024
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
dbussink added a commit that referenced this pull request Dec 12, 2024
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
Co-authored-by: Dirkjan Bussink <d.bussink@gmail.com>
Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Co-authored-by: Harshit Gangal <harshit@planetscale.com>
dbussink added a commit that referenced this pull request Dec 12, 2024
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Co-authored-by: Dirkjan Bussink <d.bussink@gmail.com>
Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
harshit-gangal pushed a commit that referenced this pull request Dec 12, 2024
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Co-authored-by: Dirkjan Bussink <d.bussink@gmail.com>
Co-authored-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport to: release-19.0 Needs to be back ported to release-19.0 Backport to: release-20.0 Needs to be backport to release-20.0 Backport to: release-21.0 Needs to be backport to release-21.0 Component: General Changes throughout the code base Type: Testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants