Skip to content

Race condition in readWriteToCloserWrapper causes panic in concurrent Read/Close #2400

Description

@amritansh1502

What Happened

readWriteToCloserWrapper in pkg/ioutils/readers.go embeds io.Reader directly with no synchronization between Read and Close. When Close is called by one goroutine while another is reading (e.g. via tar-split NewInputTarStream), it results in a nil pointer dereference panic in
bufio.(*Reader).Read.This causes CRI-O crash loops during concurrent ImagePull/ImageStatus operations: cri-o/cri-o#10179

Reproducer and full analysis in the CRI-O issue above.

Happy to submit a fix PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions