Skip to content

lightning may panic when user cancel #41235

@lance6716

Description

@lance6716

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

use failpoint to reproduce pingcap/tiflow#8209

panic: send on closed channel

goroutine 345 [running]:
github.com/pingcap/tidb/br/pkg/membuf.(*Pool).release(0xc0006a88d0, {0x7fa9d430b010, 0x100000, 0x100000})
        /home/lance/Projects/tidb/br/pkg/membuf/buffer.go:112 +0x72
github.com/pingcap/tidb/br/pkg/membuf.(*Buffer).Destroy(0xc001718050)
        /home/lance/Projects/tidb/br/pkg/membuf/buffer.go:177 +0x185
github.com/pingcap/tidb/br/pkg/lightning/backend/local.(*Writer).Close(0xc000a494d0, {0x521b7e8?, 0xc000d60d70?})
        /home/lance/Projects/tidb/br/pkg/lightning/backend/local/engine.go:1201 +0x1c3
github.com/pingcap/tidb/br/pkg/lightning/backend.(*LocalEngineWriter).Close(...)
        /home/lance/Projects/tidb/br/pkg/lightning/backend/backend.go:431
github.com/pingcap/tidb/br/pkg/lightning/restore.(*TableRestore).restoreEngine.func3(0x0?, 0xc000dff3a0)
        /home/lance/Projects/tidb/br/pkg/lightning/restore/table_restore.go:595 +0x24e
created by github.com/pingcap/tidb/br/pkg/lightning/restore.(*TableRestore).restoreEngine
        /home/lance/Projects/tidb/br/pkg/lightning/restore/table_restore.go:582 +0x117b

2. What did you expect to see? (Required)

no panic

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions