Skip to content

Issue of abnormal disconnection of TCP connection in live streaming pull end unable to release #1044

Closed

Description

@juntaoliu

When using the cluster mode of SRS, consider the following scenarios:

When using a player to play a live stream from the edge, the following scenario should be considered:

When establishing a playback connection (e.g., C1) from the edge, the edge will initiate an ingest connection (C2) with the origin server to pull the live stream. If the stream exists at that time, the live stream can be played normally. This is the normal usage mode of the cluster mode.

However, if the live stream has not started streaming yet or if there is no such stream at all, the connection C1 from the edge will be maintained until the live stream arrives.

If, at this time, a network anomaly causes the communication between the player and the edge to be disconnected (such as network interruption or sudden power failure), in this case, the playback connection C1 established by the player does not disconnect properly because the player side does not have the opportunity to send a TCP connection termination FIN.

In this situation, the connection C1 becomes a persistent TCP connection, but the client side of this TCP connection cannot be recovered.

If the live stream starts pushing, the edge will attempt to send data into the TCP connection and will find that the TCP connection is no longer active, so it will close the TCP connection.

But what if this stream doesn't exist at all?

Then this TCP connection C1 will continue to exist and will not be released until SRS is restarted.

TRANS_BY_GPT3

Activity

  1. winlinvip commented on Jan 7, 2018

    @winlinvip
    Member

    This should be similar to when one side of the network cable is unplugged, and the other side needs to detect the disconnection. Generally, in the TCP layer, KEEPALIVE is used to detect whether the connection is disconnected.

    TRANS_BY_GPT3

  2. added a commit that references this issue on Jan 7, 2018
  3. winlinvip commented on Jan 7, 2018

    @winlinvip
    Member

    I changed it to SRS_PERF_SO_KEEPALIVE, which is not enabled by default. That's how SRS2 is now.
    In SRS3, if you think it should be enabled by the user, you can change it to read the configuration. If there are no issues with enabling it, then it should be enabled by default.

    TRANS_BY_GPT3

  4. added this to the milestone on Jan 7, 2018
  5. added a commit that references this issue on Jan 7, 2018
  6. winlinvip commented on Aug 23, 2021

    @winlinvip
    Member

    Fixed.

  7. self-assigned this
    on Sep 12, 2021
  8. changed the title [-]直播拉流端异常断开TCP连接无法释放的问题[/-] [+]Issue of abnormal disconnection of TCP connection in live streaming pull end unable to release[/+] on Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugIt might be a bug.TransByAITranslated by AI/GPT.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions