aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-08-07 16:51:14 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-08-07 16:51:14 -0700
commit5d7ed5cbce33c5f91ff76cea950102648f527cf8 (patch)
tree3dcf6fbb31b6f88dd23694878586978172bac028
parent12dbc1ed7b08ad49d97277fe950f90488163ac8f (diff)
downloadbun-5d7ed5cbce33c5f91ff76cea950102648f527cf8.tar.gz
bun-5d7ed5cbce33c5f91ff76cea950102648f527cf8.tar.zst
bun-5d7ed5cbce33c5f91ff76cea950102648f527cf8.zip
Improve memlock limit error
-rw-r--r--src/http_client_async.zig29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/http_client_async.zig b/src/http_client_async.zig
index 7b376c986..f24f27f81 100644
--- a/src/http_client_async.zig
+++ b/src/http_client_async.zig
@@ -66,6 +66,35 @@ pub fn onThreadStart(_: ?*anyopaque) ?*anyopaque {
\\
, .{});
break :log;
+ } else if (err == error.SystemResources) {
+ Output.prettyErrorln(
+ \\<red>error<r>: memlock limit exceeded
+ \\
+ \\To fix this error: <b>please increase the memlock limit<r> or upgrade to Linux kernel 5.11+
+ \\
+ \\If Bun is running inside Docker, make sure to set the memlock limit to unlimited (-1)
+ \\
+ \\ docker run --rm --init --ulimit memlock=-1:-1 jarredsumner/bun:edge
+ \\
+ \\To bump the memlock limit, check one of the following:
+ \\ /etc/security/limits.conf
+ \\ /etc/systemd/user.conf
+ \\ /etc/systemd/system.conf
+ \\
+ \\You can also try running bun as root.
+ \\
+ \\If running many copies of Bun via exec or spawn, be sure that O_CLOEXEC is set so
+ \\that resources are not leaked when the child process exits.
+ \\
+ \\Why does this happen?
+ \\
+ \\Bun uses io_uring and io_uring accounts memory it
+ \\needs under the rlimit memlocked option, which can be
+ \\quite low on some setups (64K).
+ \\
+ \\
+ , .{});
+ break :log;
}
}