Skip to content

Commit f6aeca0

Browse files
committed
Clarify setStackSize error message
Show the actual attempted stack size value (capped at hard limit) separately from the desired value, making it clearer what's happening when the hard limit is lower than requested.
1 parent 341c42f commit f6aeca0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libutil/current-process.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@ void setStackSize(size_t stackSize)
6565
struct rlimit limit;
6666
if (getrlimit(RLIMIT_STACK, &limit) == 0 && static_cast<size_t>(limit.rlim_cur) < stackSize) {
6767
savedStackSize = limit.rlim_cur;
68-
limit.rlim_cur = std::min(static_cast<rlim_t>(stackSize), limit.rlim_max);
68+
auto requestedSize = std::min(static_cast<rlim_t>(stackSize), limit.rlim_max);
69+
limit.rlim_cur = requestedSize;
6970
if (setrlimit(RLIMIT_STACK, &limit) != 0) {
7071
logger->log(
7172
lvlError,
7273
HintFmt(
73-
"Failed to increase stack size from %1% to %2% (maximum allowed stack size: %3%): %4%",
74+
"Failed to increase stack size from %1% to %2% (desired: %3%, maximum allowed: %4%): %5%",
7475
savedStackSize,
76+
requestedSize,
7577
stackSize,
7678
limit.rlim_max,
7779
std::strerror(errno))

0 commit comments

Comments
 (0)