rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.76k stars 312 forks source link

Error will occur during 16-core compilation: "os_error": "Too many open files", "syscall": "epoll_create1" #428

Closed SunJun8 closed 2 years ago

SunJun8 commented 2 years ago

Describe the bug I use 16-core cpu to compile the code in wsl2 and it appears:

E1115 08:09:18.237944911   21248 ev_epollex_linux.cc:1305]   pollset_add_fd: {"created":"@1636963758.237881690","description":"pollset_transition_pollable_from_empty_to_fd","file":"src/core/lib/iomgr/ev_epollex_linux.cc","file_line":324,"referenced_errors":[{"created":"@1636963758.237879486","description":"get_fd_pollable","file":"src/core/lib/iomgr/ev_epollex_linux.cc","file_line":324,"referenced_errors":[{"created":"@1636963758.237876250","description":"Too many open files","errno":24,"file":"src/core/lib/iomgr/ev_epollex_linux.cc","file_line":567,"os_error":"Too many open files","syscall":"epoll_create1"}]}]}
E1115 08:09:18.238201658   21240 ev_epollex_linux.cc:1305]   pollset_add_fd: {"created":"@1636963758.238152293","description":"pollset_transition_pollable_from_empty_to_fd","file":"src/core/lib/iomgr/ev_epollex_linux.cc","file_line":324,"referenced_errors":[{"created":"@1636963758.238151371","description":"get_fd_pollable","file":"src/core/lib/iomgr/ev_epollex_linux.cc","file_line":324,"referenced_errors":[{"created":"@1636963758.238149157","description":"Too many open files","errno":24,"file":"src/core/lib/iomgr/ev_epollex_linux.cc","file_line":567,"os_error":"Too many open files","syscall":"epoll_create1"}]}]}
E1115 08:09:18.238716543   21248 ev_epollex_linux.cc:1305]   pollset_add_fd: {"created":"@1636963758.238665726","description":"pollset_transition_pollable_from_empty_to_fd","file":"src/core/lib/iomgr/ev_epollex_linux.cc","file_line":324,"referenced_errors":[{"created":"@1636963758.238664403","description":"get_fd_pollable","file":"src/core/lib/iomgr/ev_epollex_linux.cc","file_line":324,"referenced_errors":[{"created":"@1636963758.238662991","description":"Too many open files","errno":24,"file":"src/core/lib/iomgr/ev_epollex_linux.cc","file_line":567,"os_error":"Too many open files","syscall":"epoll_create1"}]}]}

To Reproduce using CPU with 16 cores or more to compile code

Expected behavior same as above

Environment:

Additional context

rizsotto commented 2 years ago

Thanks for the report @SunJun8 .

Is there any chance that you can use the latest version of this tool? Maybe compile it against a recent version of gRPC?

The are too many open file descriptor, which is a result of a gRPC bug (search their github issues, I think it's still open). As a workaround, you can increase the number of open file descriptors. (See limit command.)

I'm closing this ticket, because I can't do much about this problem in this project. (Other than not using gRPC, but that's a long term plan.)

SunJun8 commented 2 years ago

Thanks for the report @SunJun8 .

Is there any chance that you can use the latest version of this tool? Maybe compile it against a recent version of gRPC?

The are too many open file descriptor, which is a result of a gRPC bug (search their github issues, I think it's still open). As a workaround, you can increase the number of open file descriptors. (See limit command.)

I'm closing this ticket, because I can't do much about this problem in this project. (Other than not using gRPC, but that's a long term plan.)

Thanks Reply

I just want to know whether bear can directly circumvent this problem, rather than modify fd limit, but this is indeed the most direct way to solve the problem

rizsotto commented 2 years ago

Reducing the parallelism of your build can mitigate the problem too.

SunJun8 commented 2 years ago

Reducing the parallelism of your build can mitigate the problem too.

Yes, but this is a waste of my precious cpu core image