libtorrent icon indicating copy to clipboard operation
libtorrent copied to clipboard

fix(poll_epoll.cc): add exception handling for m_table array allocation

Open Moret84 opened this issue 2 years ago • 0 comments

The try-catch block has been added to handle the std::bad_alloc exception that may occur when allocating memory for the m_table array. If the exception is thrown, an internal_error is raised with a message indicating that too much space was requested.

This pull-request is more a "report an issue" than a real fix. I recently encountered an issue that prevented me to use rtorrent inside a docker container. The issue is caused by a huge value of the system variable _SC_OPEN_MAX, that is directly used to allocate an array. More informations here and here. As I had a hard time finding the issue, I think it would be interesting to report the issue with a more accurate message. I am not sure at all this is the right fix. Please let me know if I can do anything other.

Thanks for your read and your time.

Moret84 avatar Apr 01 '23 19:04 Moret84