-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server has a large number of CLOSE_WAIT (client has already closed) #633
Comments
TCP is like this, unsolvable.
|
I solve the resource leakage and CLOSE_WAIT problem using the following methods.
|
|
This is not a TCP issue, but a bug in SRS. When starting the http-flv function, the player requests a non-existent stream. The program enters an infinite loop in serve_http, unable to proceed with subsequent execution, unable to close the socket, and unable to send out FIN, resulting in the accumulation of CLOSE_WAIT.
|
Well, not checking the fd status resulted in closing it before exiting the loop. It should be fixed.
|
It is obviously unrealistic to solve the fd leakage elegantly under the current architecture. However, it can be resolved using my more conservative approach. The ingester can be set with a timeout for returning to the source. If the ingester fails to return within the specified time, it can be released at the application level, thus resolving the close-wait issue. Reference to the previous comment: ingester_auto_release
|
I will find time to fix it over the weekend.
|
If you think your solution is simple and reliable, you should submit a PR, because a PR can show what modifications have been made. If you just paste the code into an issue, I won't be able to understand what changes have been made.
|
May I ask if this problem has been resolved? We encountered it during our usage.
|
The problem of merging into 636 has been resolved, at ae54501.
|
Fixed by f2b4bc7 |
Configuration: SRS as the edge server, nginx rtmp as the origin server.
Reproduction steps:
for i in {1..2000}; do curl -m 1 "http://192.168.5.222:8090/live/livestream${i}.flv"; done
Results:
netstat -an | grep 8090 | grep CLOSE_WAIT | wc -l
1963
Note: This situation does not occur with rtmp requests. Could it be that the http server side is not closing the file descriptor?
Configuration file:
listen 1936;
max_connections 8196;
pid objs/srs.pid;
srs_log_level verbose;
srs_log_file objs/srs.log;
http_server {
enabled on;
listen 8090;
dir ./objs/nginx/html;
}
vhost defaultVhost {
mode remote;
origin 127.0.0.1:1939;
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
hstrs on;
}
}
SRS log:
[2016-08-24 13:52:29.861][trace][18243][1012] edge pull connected, url=rtmp://127.0.0.1:1939/live/livestream146, server=127.0.0.1:1939
[2016-08-24 13:52:29.861][trace][18243][6114] edge pull connected, url=rtmp://127.0.0.1:1939/live/livestream1002, server=127.0.0.1:1939
[2016-08-24 13:52:29.861][trace][18243][10044] edge pull connected, url=rtmp://127.0.0.1:1939/live/livestream1671, server=127.0.0.1:1939
[2016-08-24 13:52:29.861][trace][18243][7686] edge pull connected, url=rtmp://127.0.0.1:1939/live/livestream1268, server=127.0.0.1:1939
[2016-08-24 13:52:29.861][trace][18243][9228] edge pull connected, url=rtmp://127.0.0.1:1939/live/livestream1530, server=127.0.0.1:1939
[2016-08-24 13:52:29.866][warn][18243][11766][104] origin disconnected, retry. ret=1007
[2016-08-24 13:52:29.866][warn][18243][8412][104] origin disconnected, retry. ret=1007
[2016-08-24 13:52:29.867][warn][18243][1294][104] origin disconnected, retry. ret=1007
[2016-08-24 13:52:29.867][warn][18243][9888][104] origin disconnected, retry. ret=1007
[2016-08-24 13:52:29.867][warn][18243][11292][104] origin disconnected, retry. ret=1007
[2016-08-24 13:52:29.867][warn][18243][3832][104] origin disconnected, retry. ret=1007
TRANS_BY_GPT3
The text was updated successfully, but these errors were encountered: