Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edge: Crash when republish to origin server. When republishing the stream from the edge to the upper layer, a core dump issue occurs occasionally when the socket is closed at the end of the stream. #2419

Closed
mapengfei53 opened this issue Jun 17, 2021 · 4 comments
Assignees
Labels
Bug It might be a bug. good first issue Easy to fix issues, good for newcomers PullRequest Has PR or solution in issue. TransByAI Translated by AI/GPT.
Milestone

Comments

@mapengfei53
Copy link
Contributor

mapengfei53 commented Jun 17, 2021

Description'

Please ensure that the markdown structure is maintained.

When pushing the edge stream to the upper layer, a core dump problem occasionally occurs at the end of the stream.

Please ensure that the markdown structure is maintained.

  1. SRS version: srs-3.0release
  2. The log of SRS is as follows:

Please ensure that the markdown structure is maintained.

#0  0x00007f672b492337 in raise () from /lib64/libc.so.6
#1  0x00007f672b493a28 in abort () from /lib64/libc.so.6
#2  0x00007f672b48b156 in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007f672b48b202 in __assert_fail () from /lib64/libc.so.6
#4  0x00000000004ad0a7 in srs_close_stfd (stfd=@0x4fc2008: 0x2deaf00) at src/service/srs_service_st.cpp:87
#5  0x00000000004afb9b in SrsTcpClient::close (this=0x4fc2000) at src/service/srs_service_st.cpp:611
#6  0x00000000004af705 in SrsTcpClient::~SrsTcpClient (this=0x4fc2000, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at src/service/srs_service_st.cpp:581
#7  0x00000000004af992 in SrsTcpClient::~SrsTcpClient (this=0x4fc2000, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at src/service/srs_service_st.cpp:584
#8  0x00000000004bc1d1 in SrsBasicRtmpClient::close (this=0x4a03d50) at src/service/srs_service_rtmp_conn.cpp:103
#9  0x00000000004bbc99 in SrsBasicRtmpClient::~SrsBasicRtmpClient (this=0x4a03d50, __in_chrg=<optimized out>) at src/service/srs_service_rtmp_conn.cpp:61
#10 0x00000000004cd169 in SrsSimpleRtmpClient::~SrsSimpleRtmpClient (this=0x4a03d50, __in_chrg=<optimized out>) at src/app/srs_app_rtmp_conn.cpp:80
#11 0x00000000004cd198 in SrsSimpleRtmpClient::~SrsSimpleRtmpClient (this=0x4a03d50, __in_chrg=<optimized out>) at src/app/srs_app_rtmp_conn.cpp:82
#12 0x00000000005ba2af in SrsEdgeForwarder::stop (this=0x4225550) at src/app/srs_app_edge.cpp:848
#13 0x00000000005bb43a in SrsPublishEdge::on_proxy_unpublish (this=0x3fb80d0) at src/app/srs_app_edge.cpp:1129
#14 0x00000000004f8b53 in SrsSource::on_edge_proxy_unpublish (this=0x45b99a0) at src/app/srs_app_source.cpp:2940
#15 0x00000000004e416f in SrsRtmpConn::release_publish (this=0x47ff330, source=0x45b99a0) at src/app/srs_app_rtmp_conn.cpp:1498
#16 0x00000000004e0d08 in SrsRtmpConn::publishing (this=0x47ff330, source=0x45b99a0) at src/app/srs_app_rtmp_conn.cpp:1255
#17 0x00000000004dd472 in SrsRtmpConn::stream_service_cycle (this=0x47ff330) at src/app/srs_app_rtmp_conn.cpp:873
#18 0x00000000004dbf63 in SrsRtmpConn::service_cycle (this=0x47ff330) at src/app/srs_app_rtmp_conn.cpp:698
#19 0x00000000004cee70 in SrsRtmpConn::do_cycle (this=0x47ff330) at src/app/srs_app_rtmp_conn.cpp:224
#20 0x00000000004ccd8a in SrsConnection::cycle (this=0x47ff3f8) at src/app/srs_app_conn.cpp:172
#21 0x000000000053194e in SrsSTCoroutine::cycle (this=0x4fb6450) at src/app/srs_app_st.cpp:198
#22 0x00000000005319c3 in SrsSTCoroutine::pfn (arg=0x4fb6450) at src/app/srs_app_st.cpp:213
#23 0x0000000000601bdb in _st_thread_main () at sched.c:337
#24 0x000000000060234b in st_thread_create (start=0xffffffffffffffff, arg=0x4fb6450, joinable=0, stk_size=6296537) at sched.c:616
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

  1. The configuration of SRS is as follows:

Please ensure that the markdown structure is maintained.

# the config for srs origin-edge cluster
# @see https://github.com/ossrs/srs/wiki/v1_CN_Edge
# @see full.conf for detail config.

listen              1935;
max_connections     1000;
pid                 objs/edge.pid;
daemon              off;
srs_log_tank        console;
vhost __defaultVhost__ {
    cluster {
        mode            remote;
        origin          127.0.0.1:19350;
    }
}

Current analysis of the reasons:

Please ensure that the markdown structure is maintained.

Currently, the core dump occurs because the function st_netfd_close returns err = -1, which triggers an assert call. Some experts say that this is caused by closing the coroutine before closing the socket.

Please ensure that the markdown structure is maintained.

1. void srs_close_stfd(srs_netfd_t& stfd)
{
    if (stfd) {
        // we must ensure the close is ok.
        int err = st_netfd_close((st_netfd_t)stfd);
        srs_assert(err != -1);
        stfd = NULL;
    }
}
2. void SrsEdgeForwarder::stop()
{
    trd->stop();
    queue->clear();
    srs_freep(sdk);
}
3. The function `SrsEdgeForwarder::stop()` first executes `trd->stop();` and then executes `srs_freep(sdk); srs_freep(sdk);`, which calls the destructor and performs the `close()` operation on the socket. Currently, this issue occurs sporadically, and it is unclear whether this problem is causing it.

Please ensure that the markdown structure is maintained.

Expected behavior (Expect)

Please ensure that the markdown structure is maintained.

Expected to fix this core dump issue.

Please ensure that the markdown structure is maintained.

TRANS_BY_GPT3

winlinvip added a commit that referenced this issue Jun 24, 2021
@winlinvip winlinvip added Bug It might be a bug. PullRequest Has PR or solution in issue. labels Aug 18, 2021
@winlinvip
Copy link
Member

winlinvip commented Aug 18, 2021

👍 This is problematic.

TRANS_BY_GPT3

@winlinvip winlinvip added this to the SRS 4.0 release milestone Aug 25, 2021
@chen-guanghua
Copy link
Contributor

chen-guanghua commented Oct 5, 2021

@mapengfei53, please provide the following information: "Provide the coredump that occurred.

TRANS_BY_GPT3

@winlinvip winlinvip self-assigned this Dec 26, 2021
@winlinvip
Copy link
Member

winlinvip commented Dec 26, 2021

Dup to #1784 has already been updated with the log. We need to wait for the problem to be reproduced, which has a relatively low probability.

Postpone to SRS 5.0.

TRANS_BY_GPT3

@winlinvip winlinvip modified the milestones: 4.0, 5.0 Dec 26, 2021
@winlinvip winlinvip added the good first issue Easy to fix issues, good for newcomers label Jan 17, 2022
@winlinvip winlinvip changed the title 边缘转推流到上层的时候,在推流结束的时候偶现socket 关闭的时候引起core dump问题 Edge: Crash when republish to origin server. 边缘转推流到上层的时候,在推流结束的时候偶现socket 关闭的时候引起core dump问题 Jan 2, 2023
@winlinvip winlinvip changed the title Edge: Crash when republish to origin server. 边缘转推流到上层的时候,在推流结束的时候偶现socket 关闭的时候引起core dump问题 Edge: Crash when republish to origin server. When republishing the stream from the edge to the upper layer, a core dump issue occurs occasionally when the socket is closed at the end of the stream. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
@winlinvip
Copy link
Member

Dup to #1941

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It might be a bug. good first issue Easy to fix issues, good for newcomers PullRequest Has PR or solution in issue. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

3 participants