Skip to content

Bug Report: Goroutine Leak in TSO Dispatcher When Stream Errors Occur #9619

@felixYing

Description

@felixYing

Bug Report

What did you do?

Enable tso proxy, the pd follower has goroutine leak.
When stream errors during request processing were causing goroutine leaks. Specifically, when a stream error occurred, pending requests were not being properly cleaned up, leaving goroutines in a blocked state waiting for responses that would never arrive.

In environments with unstable network connections or frequent stream errors, this issue would lead to a continuous increase in goroutine count and memory usage over time.

What did you expect to see?

When stream errors occur, all pending requests should be promptly cancelled, and associated goroutines should be released to prevent resource leaks. The system should maintain stable memory usage even under error conditions.

What did you see instead?

Pending requests were not being properly cancelled when stream errors occurred, causing goroutines to remain blocked indefinitely. This led to a gradual increase in memory usage and potential performance degradation over time, especially in long-running systems with frequent stream errors.

Image

What version of PD are you using (pd-server -V)?

all version since v5.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.affects-9.0This bug affects the 9.0.x versions.contributionThis PR is from a community contributor.first-time-contributorIndicates that the PR was contributed by an external member and is a first-time contributor.impact/leakseverity/majortype/bugThe issue is confirmed as a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions