Description
Description
Describe the problem you encountered.
When pushing the stream to SRS, the SRS process crashed.
Environment
- Operating System: CentOS
- Encoder (Tool and Version):
...
- Player (Tool and Version):
...
- SRS Version: 2.0.248
- SRS log is as follows:
client identified, type=fmle-publish, stream_name=62c1352ea3a64621999bfd946081f392, duration=-1.00
connected stream, tcUrl=rtmp://172.16.129.97/netposa, pageUrl=, swfUrl=, schema=rtmp, vhost=defaultVhost, port=1935, app=netposa, stream=62c1352ea3a64621999bfd946081f392, args=null
st_thread_create failed. ret=1017(Cannot allocate memory)
Reproduction
The steps to reproduce the bug are as follows:
- Start SRS, run
...
- Push the stream, run
...
- The bug is reproduced, and the key information is as follows:
...
Expected Behavior
Describe what you expect to happen.
By examining the stack analysis, the reasons are as follows:
During the push stream process, the function SrsSource::initialize is called, which then calls hls->initialize. However, an error occurs in hls->initialize, specifically st_thread_create failed, resulting in an error code being returned. In the function SrsSource::fetch_or_create, srs_freep(source) is called, leading to the destructor of SrsSource being invoked. As a result, the member variable play_edge is released, triggering its destructor and subsequently calling the destructor of the SrsPlayEdge member variable ingester. The stop function is called, ultimately invoking _source->on_unpublish(). Since the call to hls->initialize failed and returned without calling play_edge->initialize(this, _req), the _source pointer in SrsEdgeIngester is null, causing a core dump. Therefore, adding a null check before using _source can resolve the issue.
I hope someone knowledgeable can help answer why st_thread_create failed and why it resulted in a failure.
TRANS_BY_GPT3