## Bug Report Please answer these questions before submitting your issue. Thanks! ### 1. Minimal reproduce step (Required) Perform `br log truncate --until` ### 2. What did you expect to see? (Required) Truncate happens successfully. ### 3. What did you see instead (Required) Panics with this stack trace: ``` We are going to truncate 3030 files, up to TS 2025-09-03 01:42:23.0000. panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0х5848f74] goroutine 3865 [running]: github.com/pingcap/tidb/br/pkg/stream.MigrationExt.cleanUpFor({...}, 0x4002720fc0, 0x400084eed8) /.../release/tidb/br/pkg/stream/stream_netas.go:896 +0x584 github.com/pingcap/tidb/br/pkg/stream.MigrationExt.doTruncateLogs.func3() /.../release/tidb/br/pkg/stream/stream_metas.go:1102 +0x2c4 ... ``` ### 4. What is your TiDB version? (Required) v8.5.1
Activity
kennytm commentedon Sep 3, 2025
This bug only affects v8.5. The function does not exist on v8.1, and has been silently fixed by #56761 on v9.0.
The cause is in here,
aOutis zero-initialized, so its fieldaOut.NewBaseis a nil pointertidb/br/pkg/stream/stream_metas.go
Lines 1104 to 1105 in 60dd195
but such field is later deferenced in
tidb/br/pkg/stream/stream_metas.go
Line 899 in 60dd195
so it caused the SIGSEGV.
In v9.0
aOut.NewBasepointer is allocated:tidb/br/pkg/stream/stream_metas.go
Lines 1466 to 1468 in 6134393
br/stream: initialize `newBase` for `doTruncateLog`. (#63363)