winshining / nginx-http-flv-module

A media streaming server based on nginx-rtmp-module. In addtion to the features nginx-rtmp-module provides, HTTP-FLV, GOP cache, VHosts (one IP for multi domain names) and JSON style statistics are supported now.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[bug] live: already publishing

streamingsystems opened this issue · comments

When you meet a bug, please open the issue including a title prefixed by '[bug]' and describe it as follows:

Hi Sir,

I hope you received the PayPal money that I sent to you a few weeks back for your effort in this project.

I am not sure if this is a bug or not but I am not understanding the behavior or this is a bug in the code.

We are streaming from ffmpeg to the rtmp server and it appears to be working just fine.

However, our server logs are filling with this after a long time of streaming.

2023/10/10 20:07:16 [error] 640209#640209: *280500 live: already publishing, client: , server: 0.0.0.0:1935
2023/10/10 20:07:16 [error] 640208#640208: *280490 live: already publishing, client: , server: 0.0.0.0:1935

Yesterday we had 35GB of these logs and it was filling up our hard drive by the end of the day.

In this report from a few years ago:

#159

You write:

By the way, "live: already publishing" is not weird, it will always happen if configuration file as yours is used.

The command in #159 is similar to our command:

ffmpeg -stream_loop -1 -re -i low.mp4 -map 0 -c copy -f flv rtmp://127.0.0.1:1935/

Expected behavior (期望行为)

Not to have these messages in our log file.

Actual behavior (实际行为)

We have many of these errors in our log file.

OS and Nginx version (操作系统和 Nginx 版本号)

Latest

Configuration file (配置文件)

In nginx.conf:

worker_processes auto;

rtmp_auto_push on;

rtmp {

out_queue           4096;
out_cork            8;
max_streams         256;
timeout             2s;
respawn off;

...

}

application live{
live on;
wait_key on;
allow publish all;
allow play all;
gop_cache off;
}

Steps to reproduce the behavior (复现问题步骤)

It's hard for us to reproduce this at will, but over time for possibly long running ffmpeg processes these logs come in very frequently, it seems like every second exactly.

Error log if any (错误日志)

I did some more investigating in the code and could be be possible that this is some how an error in ffmpeg? I looked at ffmpeg in debug mode and it seems like it's running fine looping a mp4 file from the disk and sending RTMP to nginx.

Would it be possible there is a bug in ffmpeg that every second it's trying to "join" as a publisher but it's already a publisher for a specific stream. It does not happen right away in ffmpeg when we start just over time we notice these errors.

Well, you mentioned in #245 that if you removed the directive:

drop_idle_publisher

ffmpeg would not fail repeatedly pushing streams.

Maybe that is the reason. As the directive is removed, server will never drop the stuck or idle publishers as result of some problems (e.g., network being unavailable temporarily) and the subsequent publishers with the same stream name will be rejected (live: already publsihing).

drop_idle_publisher 15s;

is an appropriate setting.

I advise you remove the directives:

log_interval

and

log_size

These directives are used for debugging. Nginx only logs once after the streams are closed, it's difficult to know steam state during process.

PS: No donation has been received yet, I don't know why :(

I just contacted PayPal and they said the funds were delivered correctly.

Hi,

Also for some reason our logs fill sometimes over and over with this message, but it seems to work most of the time do you know what would cause this?

2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.17 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.18 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.19 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.20 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.22 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.23 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.24 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.25 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.26 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.27 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.28 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.29 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.30 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.31 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.32 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.33 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.34 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.35 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.36 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.37 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.38 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.39 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.40 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.41 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.42 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.43 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.44 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.45 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.46 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.47 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: connect() to unix:/tmp/nginx-http-flv.48 failed (111: Connection refused)
2023/10/18 11:43:33 [error] 238153#238153: *5373676 auto_push: connect failed: slot=16 pid=494356 name='1_1_347_1_yduhMEWAD1nnIiw88TsckTFSFxg8FeEpxLjW8xZbIfV7dbuOPHXl46gYlRkW5Prl_1', client: 127.0.0.1, server: 0.0.0.0:1935
2023/10/18 11:43:33 [error] 238153#238153: *5373676 auto_push: connect failed: slot=17 pid=238149 name='1_1_347_1_yduhMEWAD1nnIiw88TsckTFSFxg8FeEpxLjW8xZbIfV7dbuOPHXl46gYlRkW5Prl_1', client: 127.0.0.1, server: 0.0.0.0:1935
2023/10/18 11:43:33 [error] 238153#238153: *5373676 auto_push: connect failed: slot=18 pid=238150 name='1_1_347_1_yduhMEWAD1nnIiw88TsckTFSFxg8FeEpxLjW8xZbIfV7dbuOPHXl46gYlRkW5Prl_1', client: 127.0.0.1, server: 0.0.0.0:1935

It seemed work, the new problem will be discussed in another issue.