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

cdc-bank: fix panic caused by nil pointer #414

Merged
merged 1 commit into from
Jun 1, 2021

Conversation

zyguan
Copy link
Contributor

@zyguan zyguan commented Jun 1, 2021

Signed-off-by: zyguan zhongyangguan@gmail.com

What problem does this PR solve?

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x14b68f1]

goroutine 222 [running]:
sync.(*Mutex).Lock(...)
	/usr/local/go/src/sync/mutex.go:74
database/sql.(*DB).conn(0x0, 0x1b66040, 0xc00005c030, 0xc000696001, 0x7f33a848d008, 0xc000630000, 0x0)
	/usr/local/go/src/database/sql/sql.go:1132 +0x41
database/sql.(*DB).exec(0x0, 0x1b66040, 0xc00005c030, 0x18f0c35, 0x8, 0x0, 0x0, 0x0, 0x1, 0x14c4130, ...)
	/usr/local/go/src/database/sql/sql.go:1495 +0x66
database/sql.(*DB).ExecContext(0x0, 0x1b66040, 0xc00005c030, 0x18f0c35, 0x8, 0x0, 0x0, 0x0, 0x0, 0x14004e5860, ...)
	/usr/local/go/src/database/sql/sql.go:1477 +0xde
database/sql.(*DB).Exec(...)
	/usr/local/go/src/database/sql/sql.go:1491
github.com/pingcap/tipocket/tests/cdc-bank.isTableExist(0x1b66080, 0xc000114240, 0x0, 0x18f2fd5, 0xa, 0xc0009a6570)
	/src/tests/cdc-bank/bank.go:302 +0x81
github.com/pingcap/tipocket/tests/cdc-bank.waitTable(0x1b66080, 0xc000114240, 0x0, 0x18f2fd5, 0xa)
	/src/tests/cdc-bank/bank.go:288 +0x77
github.com/pingcap/tipocket/tests/cdc-bank.(*client).Start(0xc0005a0bf8, 0x1b66080, 0xc0006960c0, 0x0, 0x0, 0xc0006e18c0, 0x2, 0x2, 0x16, 0x1)
	/src/tests/cdc-bank/bank.go:121 +0x71e
github.com/pingcap/tipocket/pkg/control.(*Controller).TransferControlToClient.func2(0xc000877768, 0x0)
	/src/pkg/control/control.go:281 +0x15b
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc0008c60c0, 0xc000670100)
	/go/pkg/mod/golang.org/x/sync@v0.0.0-20200625203802-6e8e738ad208/errgroup/errgroup.go:57 +0x64
created by golang.org/x/sync/errgroup.(*Group).Go
	/go/pkg/mod/golang.org/x/sync@v0.0.0-20200625203802-6e8e738ad208/errgroup/errgroup.go:54 +0x66

What is changed and how does it work?

Avoid to pass the uninitialized downstream to waitTable

Check List

Tests

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

Code changes

  • Has Go code change
  • Has CI related scripts change
  • Has Terraform scripts change

Side effects

  • Breaking backward compatibility

Related changes

  • Need to update the documentation

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: zyguan <zhongyangguan@gmail.com>
@zyguan zyguan requested a review from 3AceShowHand June 1, 2021 09:04
@zyguan
Copy link
Contributor Author

zyguan commented Jun 1, 2021

@jinlingchristopher Besides, the END_TIME might be null, then the test failed with:

2021/06/01 08:52:14 bank.go:222: [fatal] [cdc-bank] get ddl end ts error sql: Scan error on column index 9, name "END_TIME": converting NULL to string is unsupported

@3AceShowHand
Copy link

@jinlingchristopher Besides, the END_TIME might be null, then the test failed with:

2021/06/01 08:52:14 bank.go:222: [fatal] [cdc-bank] get ddl end ts error sql: Scan error on column index 9, name "END_TIME": converting NULL to string is unsupported

I will try to fix this

@3AceShowHand 3AceShowHand merged commit fe046ee into pingcap:master Jun 1, 2021
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