Skip to content

Commit

Permalink
liburing: print RLIMIT_MEMLOCK values upon ENOMEM (#1331)
Browse files Browse the repository at this point in the history
liburing: print RLIMIT_MEMLOCK values upon ENOMEM
  • Loading branch information
jmillan authored Feb 19, 2024
1 parent 595bffe commit a90d0da
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions worker/src/DepLibUring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "MediaSoupErrors.hpp"
#include "Utils.hpp"
#include <sys/eventfd.h>
#include <sys/resource.h>
#include <sys/utsname.h>

/* Static variables. */
Expand Down Expand Up @@ -330,10 +331,25 @@ DepLibUring::LibUring::LibUring()
{
this->zeroCopyEnabled = false;

MS_WARN_TAG(
info,
"io_uring_register_buffers() failed due to low memlock limit (ulimit -l), disabling zero copy: %s",
std::strerror(error));
struct rlimit l = {};

if (getrlimit(RLIMIT_MEMLOCK, std::addressof(l)) == -1)
{
MS_WARN_TAG(info, "getrlimit() failed: %s", std::strerror(errno));
MS_WARN_TAG(
info,
"io_uring_register_buffers() failed due to low RLIMIT_MEMLOCK, disabling zero copy: %s",
std::strerror(error));
}
else
{
MS_WARN_TAG(
info,
"io_uring_register_buffers() failed due to low RLIMIT_MEMLOCK (soft:%lu, hard:%lu), disabling zero copy: %s",
l.rlim_cur,
l.rlim_max,
std::strerror(error));
}
}
else
{
Expand Down

0 comments on commit a90d0da

Please sign in to comment.