-
Notifications
You must be signed in to change notification settings - Fork 216
Description
Hi,
I think I may have found an issue the handling of RTMP ping: when the ngx_rtmp_ping
is called (as the ping
timer handler) and no IO has been detected (with ping_reset = 0
) a PING_REQUEST is send from the RTMP nginx to the client, on the other side, the client is expected to send a PING_RESPONSE in return which will have the effect of setting ping_request to 1
.
But when the RMTP server send the PING_REQUEST, is also set ping_reset
to 1... so on next ngx_rtmp_ping()
call (after ping_timeout
time) the function will call ngx_rtmp_reset_ping()
and will never detect that a connection is stalled.
Here is the backtrace of the the ngx_rtmp_send_ping_request()
call showing that we pass into ngx_rtmp_send()
which set ping_reset
to 1.
#0 ngx_rtmp_send (wev=0x55926afaa900) at ../../nginx-rtmp-module-sergey/ngx_rtmp_handler.c:542
#1 0x0000559264cad18b in ngx_rtmp_send_message (s=s@entry=0x55926af6d240, out=out@entry=0x55926afc8724, priority=priority@entry=0) at ../../nginx-rtmp-module-sergey/ngx_rtmp_handler.c:751
#2 0x0000559264caf053 in ngx_rtmp_send_shared_packet (s=s@entry=0x55926af6d240, cl=0x55926afc8724) at ../../nginx-rtmp-module-sergey/ngx_rtmp_send.c:61
#3 0x0000559264cafd9d in ngx_rtmp_send_ping_request (s=s@entry=0x55926af6d240, timestamp=<optimized out>) at ../../nginx-rtmp-module-sergey/ngx_rtmp_send.c:340
#4 0x0000559264cacaee in ngx_rtmp_ping (pev=0x55926af6d398) at ../../nginx-rtmp-module-sergey/ngx_rtmp_handler.c:182
Note: this issue has been introduced by 345a00f