Description
Phenomenon: In the SRS (Simple Real-time Streaming) system, when entering the stream_service_cycle
to provide service, the client is first verified. When it is determined to be Identify_create_stream_client
, it will enter the function to create a stream. However, when parsing the information sent by the client, if it is still about creating a stream, it will call Identify_create_stream_client
again. If the client continuously sends requests to create a stream, it will recursively call Identify_create_stream_client
, causing a loop and eventually causing a core dump.
Changes made: After receiving the message, the basic header, message header, and payload are parsed. Previously, when parsing the message header, a 31-bit timestamp was used in the timestamp section. According to the RTMP (Real-Time Messaging Protocol) protocol, the extended timestamp is an absolute timestamp when fmt=0
, and it is a delta value when fmt=1
or 2
. Referring to the ngx_rtmp_recv
function in the ngx_rtmp_module
, the original timestamp parsing logic was modified as follows: for fmt=0
, the original absolute timestamp is maintained, and for fmt=1
or 2
, the delta value is used. After the modification, the aforementioned core dump issue occurred. Currently, it is not certain whether modifying the timestamp caused the continuous occurrence of the create_stream
problem. This is because the core dump may be caused by modifying the timestamp, or it may be due to abnormal behavior of the client, continuously sending requests to create a stream.
TRANS_BY_GPT3