Skip to content

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

@leiyoacang

Description

@leiyoacang

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`

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