sergey-dryabzhinsky / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
1.02k stars 214 forks source link

Empty or broken when calling on_update callback is killing relay #303

Closed mauricioabreu closed 4 years ago

mauricioabreu commented 4 years ago

I noticed one of my relays got killed after the log message below:

2019/11/30 09:37:30 [debug] 20#0: *14790 live: onFi: date='', time=''
2019/11/30 09:37:30 [info] 20#0: netcall: client send timed out (110: Operation timed out)
2019/11/30 09:37:30 [info] 20#0: *12099 notify: empty or broken HTTP response, client: x.x.x.x/live_5/inhouseingest3_407_0, server: ngx-relay
2019/11/30 09:37:30 [info] 20#0: *12099 notify: update failed, client: x.x.x.x/live_5/inhouseingest3_407_0, server: ngx-relay
2019/11/30 09:37:30 [info] 20#0: *12099 disconnect, client: x.x.x.x/live_5/inhouseingest3_407_0, server: ngx-relay
2019/11/30 09:37:30 [info] 20#0: *12099 deleteStream, client: x.x.x.x/live_5/inhouseingest3_407_0, server: ngx-relay
2019/11/30 09:37:30 [debug] 20#0: *14788 live: onFi: date='', time=''
2019/11/30 09:37:30 [debug] 20#0: *12091 live: onFi: date='', time=''

Tha notify: update is probably related to the on_update callback.

Reading the docs, I noticed it should not happen. From the docs:

Toggles strict mode for on_update callbacks. Default is off. When turned on all connection errors, timeouts as well as HTTP parse errors and empty responses are treated as update failures and lead to connection termination. When off only valid HTTP response codes other that 2xx lead to failure.

I don't set a value, so it is using the default off.

Did any of you already have a similar problem?

mauricioabreu commented 4 years ago

I solved it.

When the upstream API (using the on_update callback) is called and a timeout happens, the relay is destroyed. Even set the strict mode to off.

I handled it by forking NGINX-RTMP, forcing the handler threat errors like timeout a HTTP 200. Timeouts can happen.