Open heftig opened 8 years ago
Seems the ngx_chain_t
at 0x329be24 (s->out[221]
) is a circular list with 617 elements.
I've tried to hack around this; pretty much still untested.
diff --git a/ngx_rtmp_shared.c b/ngx_rtmp_shared.c
index 6f6e4e8de7587d54..3bdc5beeef6edef4 100644
--- a/ngx_rtmp_shared.c
+++ b/ngx_rtmp_shared.c
@@ -66,7 +66,8 @@ ngx_rtmp_free_shared_chain(ngx_rtmp_core_srv_conf_t *cscf, ngx_chain_t *in)
}
for (cl = in; ; cl = cl->next) {
- if (cl->next == NULL) {
+ /* FIXME: Don't create circular chains in the first place */
+ if (cl->next == NULL || cl->next == in) {
cl->next = cscf->free;
cscf->free = in;
return;
Ran into this same issue and your patch resolved it. Thanks!
Thanks @heftig
Merged into dev
I can reliably produce the loop -_-. I do that by trying to access the stream that includes onTextData packets from the remote host (that's an important detail, because when I do that with a local client it's not happening). The client will crash (because nginx will start sending garbage to it) and nginx will freeze in this cleaning loop. Though in my case, it seems the loop does not include the beginning of the list. Also hacking around and breaking the loop won't solve the problem for me (as Nginx will still be sending the garbage data to the client).
Works for me if I use metadata support as implemented here: https://github.com/arut/nginx-rtmp-module/pull/708 and not a version merged in this fork.
Hey @sergey-dryabzhinsky, I wanted to ask you if you would be open to the idea of accepting the metadata implementation change (replacing the current one that leads to this bug with the one referenced above)? (I plan to do that for my own purposes, as I was not able to locate an error in current implementation that leads to described behaviour)
The worker occasionally gets stuck closing a session, spinning forever. GDB obtained this backtrace:
rtmp config:
nginx 1.10.0, nginx-rtmp-module c3237ae747. I still have a core dump of the worker.