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

When the SrsHttpApi object is destructed, the program encounters a coredump, caused by srs_close_stfd. #1784

Closed
leiyoacang opened this issue May 28, 2020 · 4 comments
Assignees
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Milestone

Comments

@leiyoacang
Copy link

leiyoacang commented May 28, 2020

Description
The SrsHttpApi object causes a program core dump when it is being destructed. Specifically, the assert is triggered when calling srs_close_stfd.

Description of the issue
Please describe the problem you have encountered.

1. SRS Version: ``

SRS Version: 2.0.243

  1. SRS log:
**Core file information is as follows:**
#0  0x00007f472098499f in raise () from /lib64/libc.so.6
#1  0x00007f472096ecf5 in abort () from /lib64/libc.so.6
#2  0x00007f472096ebc9 in __assert_fail_base.cold.0 () from /lib64/libc.so.6
#3  0x00007f472097ce56 in __assert_fail () from /lib64/libc.so.6
#4  0x00000000004acbcc in srs_close_stfd (stfd=@0xac0d10: 0xb030a0) at src/app/srs_app_st.cpp:240
#5  0x0000000000474e80 in SrsConnection::dispose (this=0xac0cf0) at src/app/srs_app_conn.cpp:72
#6  0x0000000000474ca3 in SrsConnection::~SrsConnection (this=0xac0cf0, 
    __vtt_parm=0x947b08 <VTT for SrsHttpApi 8>, __in_chrg=<optimized out>) at src/app/srs_app_conn.cpp:55
#7  0x00000000004e52e9 in SrsHttpApi::~SrsHttpApi (this=0xac0cf0, __in_chrg=<optimized out>, 
    __vtt_parm=<optimized out>) at src/app/srs_app_http_api.cpp:2007
#8  0x00000000004e5381 in SrsHttpApi::~SrsHttpApi (this=0xac0cf0, __in_chrg=<optimized out>, 
    __vtt_parm=<optimized out>) at src/app/srs_app_http_api.cpp:2010
#9  0x000000000046ee15 in SrsServer::remove (this=0xabd820, conn=0xac0cf0) at src/app/srs_app_server.cpp:1167
#10 0x00000000004750ba in SrsConnection::on_thread_stop (this=0xac0cf0) at src/app/srs_app_conn.cpp:112
#11 0x00000000004a7ba3 in SrsOneCycleThread::on_thread_stop (this=0xabdc70) at src/app/srs_app_thread.cpp:398
#12 0x00000000004a73d7 in internal::SrsThread::thread_cycle (this=0xb05610) at src/app/srs_app_thread.cpp:240
#13 0x00000000004a7435 in internal::SrsThread::thread_fun (arg=0xb05610) at src/app/srs_app_thread.cpp:249
#14 0x000000000055991f in _st_thread_main () at sched.c:337
#15 0x000000000055a097 in st_thread_create (start=0x55e743 <_st_epoll_pollset_add 746>, arg=0x7f4721a48b40, 
    joinable=32583, stk_size=563801648) at sched.c:616
#16 0x000000000055929b in _st_vp_schedule () at sched.c:132



**1. The configuration of SRS is as follows (Config):**
 listen              1935;
 max_connections     1000;
 srs_log_tank        file;
 srs_log_file        ./objs/srs.log;
 http_api {
 enabled         on;
 listen          1985;
 }
http_server {
enabled         on;
 listen          8080;
 dir             ./objs/nginx/html;
}
stats {
   network         0;
    disk            sda sdb xvda xvdb;
}
 vhost __defaultVhost__ {
}


**Reproduction (Replay)**  
Occasional

**Steps to reproduce the bug (How to replay bug?)**

1. `xxxxxx`
1. `xxxxxx`
1. `xxxxxx`

**Expected behavior (Expect)**

When destructing the SrsHttpApi object, it should not trigger a core dump.
> Please describe your expectation.

`TRANS_BY_GPT3`
@winlinvip winlinvip changed the title SrsHttpApi对象析构时程序出现coredump SrsHttpApi对象析构时程序出现coredump,srs_close_stfd引起 Sep 4, 2021
@winlinvip winlinvip self-assigned this Sep 4, 2021
@winlinvip winlinvip added the Bug It might be a bug. label Sep 4, 2021
@winlinvip winlinvip added this to the 4.0 milestone Sep 4, 2021
@winlinvip
Copy link
Member

winlinvip commented Sep 4, 2021

srs_close_stfd Assertion problem, still not reproduced, will find time to investigate.

TRANS_BY_GPT3

@winlinvip winlinvip reopened this Sep 4, 2021
@winlinvip
Copy link
Member

winlinvip commented Dec 26, 2021

The log has already been updated. We need to wait for the problem to occur again, which has a relatively low probability.

Postpone to SRS 5.0.

TRANS_BY_GPT3

@mapengfei53
Copy link
Contributor

mapengfei53 commented Dec 27, 2021

Thank you for your support.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

Fixed in SRS 4

@winlinvip winlinvip modified the milestones: 5.0, 4.0 Jan 2, 2023
@winlinvip winlinvip changed the title SrsHttpApi对象析构时程序出现coredump,srs_close_stfd引起 When the SrsHttpApi object is destructed, the program encounters a coredump, caused by srs_close_stfd. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
winlinvip added a commit that referenced this issue Jul 24, 2024
…4126)

1. Should always stop coroutine before close fd, see #511, #1784
2. When edge forwarder coroutine quit, always set the error code.
3. Do not unpublish if invalid state.

---------

Co-authored-by: Jacob Su <[email protected]>
winlinvip added a commit that referenced this issue Jul 24, 2024
1. Should always stop coroutine before close fd, see #511, #1784
2. When edge forwarder coroutine quit, always set the error code.
3. Do not unpublish if invalid state.

---------

Co-authored-by: Jacob Su <[email protected]>
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. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

3 participants