Skip to content
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

After compiling and installing in the Ubuntu environment, there is a bug in obtaining the maximum number of open files. #2811

Closed
dzhcool opened this issue Dec 24, 2021 · 7 comments
Assignees
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Milestone

Comments

@dzhcool
Copy link

dzhcool commented Dec 24, 2021

Note: Before asking a question, please read the FAQ (Please read FAQ before filing an issue) #2716

Description

After compiling and installing ubuntu18.04, an error occurs when starting, indicating that the max open files parameter is incorrect. The log outputs that the system's max open files parameter is inconsistent with the actual setting value.

  1. SRS version (Version): 4.0.191

  2. SRS log is as follows (Log):

[2021-12-24 13:35:43.250][Error][9308][o342941q][22] invalid max_connections=3000, required=3107, system limit to 1024, total=3007(max_connections=3000, nb_consumed_fds=7). you can change max_connections from 3000 to 1016, or you can login as root and set the limit: ulimit -HSn 3107(Invalid argument)
[2021-12-24 13:35:43.250][Error][9308][o342941q][22] Failed, code=1023 : check config : check connections : 3007 exceed max open files=1024
  1. SRS configuration is as follows (Config):
# srs4 example for edge
listen          1935;
pid             /var/run/srs-edge-0.pid;
ff_log_dir      /gpstream/logs/ffmpeg;
srs_log_tank    file;
srs_log_level   trace;
srs_log_file    /gpstream/logs/srs-edge-0.log;
max_connections 3000;
daemon          on;

Replay
Test method:

  1. Add debug information at line 206 of trunk/src/main/srs_main_server.cpp.
int main(int argc, char** argv)
{
    int max_open_files = (int)sysconf(_SC_OPEN_MAX);
    printf("[davis-debug] max open files:%d \n", max_open_files);
  1. Add debug information at line 2877 of trunk/src/app/srs_app_config.cpp.
srs_error_t SrsConfig::check_number_connections()
{
    int _max_open_files = (int)sysconf(_SC_OPEN_MAX);
    printf("[davis-debug][srs_app_config] max open files:%d \n", _max_open_files);
  1. Debug information after compiling and starting.
[davis-debug] max open files:65535 
[2021-12-24 13:35:43.249][Trace][9308][o342941q] XCORE-SRS/4.0.191(Leo)
[2021-12-24 13:35:43.249][Trace][9308][o342941q] config parse complete
[2021-12-24 13:35:43.249][Trace][9308][o342941q] you can check log by: tail -n 30 -f /gpstream/logs/srs-edge-0.log
[2021-12-24 13:35:43.249][Trace][9308][o342941q] please check SRS by: ./etc/init.d/srs status
[davis-debug][srs_app_config] max open files:1024

Expected behavior (Expect)

Expected behavior:

In the Ubuntu system, it is expected that the detection of the "max open files" configuration in trunk/src/app/srs_app_config.cpp should be correct (regardless of whether the system configuration is correct or not, at least the feedback results from the two debugging information in SRS should be consistent).

TRANS_BY_GPT3

@dzhcool dzhcool closed this as completed Dec 24, 2021
@winlinvip winlinvip self-assigned this Dec 25, 2021
@winlinvip winlinvip added the Deleting Will deleted in future. label Dec 25, 2021
@winlinvip
Copy link
Member

winlinvip commented Dec 25, 2021

Does it look okay?

TRANS_BY_GPT3

@dzhcool

This comment was marked as spam.

@dzhcool

This comment was marked as spam.

@winlinvip winlinvip reopened this Dec 26, 2021
@winlinvip
Copy link
Member

winlinvip commented Dec 26, 2021

ST_EVENTSYS_DEFAULT is SELECT, of course it is 1024.

This can basically be determined that the underlying system has not been modified, fd limitation is a very basic Linux feature, please double-check.

TRANS_BY_GPT3

@winlinvip winlinvip added Discussion Discussion or questions. Won't fix We won't fix it. and removed Deleting Will deleted in future. labels Dec 26, 2021
@winlinvip winlinvip added this to the 5.0 milestone Dec 26, 2021
@dzhcool

This comment was marked as spam.

@winlinvip
Copy link
Member

winlinvip commented Dec 27, 2021

👍 Not bad, not bad. Found the reason, really not easy.

For the solution, it is better to proactively define this macro MD_HAVE_EPOLL. ST provides a method to set EXTRA_FLAGS, you can search for the variable _ST_EXTRA_CFLAGS.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Dec 27, 2021

I have updated it, please test version 4.0.213. Remember to delete the 'objs' folder and reconfigure.

TRANS_BY_GPT3

@winlinvip winlinvip added Bug It might be a bug. and removed Discussion Discussion or questions. Won't fix We won't fix it. labels Dec 27, 2021
@winlinvip winlinvip modified the milestones: 5.0, 4.0 Dec 27, 2021
@winlinvip winlinvip changed the title ubuntu环境下编译安装后,max open files获取bug After compiling and installing in the Ubuntu environment, there is a bug in obtaining the maximum number of open files. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

2 participants