Skip to content

Commit 719479b

Browse files
authored
Disable io_uring use in libuv (#1347)
* Disable `io_uring` use in `libuv` amazonlinux/amazon-linux-2023#840 (comment) * Update CHANGELOG.md
1 parent ab48938 commit 719479b

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## [Unreleased]
44

5+
- Setting `UV_USE_IO_URING=0` to disable `io_uring` use in `libuv` to prevent build timeouts. ([#1347](https://github.com/heroku/heroku-buildpack-nodejs/pull/1347))
56

67
## [v270] - 2024-11-13
78

bin/compile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ export PATH="$BUILD_DIR/.heroku/node/bin:$BUILD_DIR/.heroku/yarn/bin":$PATH
6464
export COREPACK_HOME="$BUILD_DIR/.heroku/corepack"
6565
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
6666

67+
# 2024-11-20:
68+
# We started getting reports on build timeouts on the platform that were unexpected
69+
# due to the specific versions on Node.js and npm which had been working fine up until
70+
# this date. After some extensive digging, we believe we narrowed down the cause to
71+
# a bug in io_uring that affects the Amazon Linux 2023 release. There is a pending fix
72+
# which will be released around Dec. 9th but, until then, the workaround is set disable
73+
# the use of io_uring in libuv.
74+
#
75+
# See https://github.com/npm/cli/issues/7814#issuecomment-2488626736
76+
# → https://github.com/amazonlinux/amazon-linux-2023/issues/840#issuecomment-2485782075
77+
# → https://lore.kernel.org/io-uring/[email protected]/T/#m57570b5f8f2fc00d5a17cfe18ffeeba9fc23a43d
78+
export UV_USE_IO_URING=${UV_USE_IO_URING:-0}
79+
6780
LOG_FILE=$(mktemp -t node-build-log.XXXXX)
6881
echo "" > "$LOG_FILE"
6982

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
A fake README, to keep npm from polluting stderr.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "libuv-uring-fix",
3+
"version": "0.0.1",
4+
"description": "node buildpack integration test app",
5+
"repository" : {
6+
"type" : "git",
7+
"url" : "http://github.com/example/example.git"
8+
},
9+
"engines": {
10+
"node": "22.x"
11+
},
12+
"scripts": {
13+
"build": "echo \"UV_USE_IO_URING is set to $UV_USE_IO_URING\""
14+
}
15+
}

test/run

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,6 +2051,21 @@ testConflictingPackageManagerMetadata() {
20512051
assertCapturedError
20522052
}
20532053

2054+
testDisableIoUringFix() {
2055+
compile "libuv_io_uring_fix"
2056+
assertCaptured "UV_USE_IO_URING is set to 0"
2057+
assertCapturedSuccess
2058+
}
2059+
2060+
testDisableIoUringFixUserOverride() {
2061+
cache_dir=$(mktmpdir)
2062+
env_dir=$(mktmpdir)
2063+
echo "1" > "$env_dir/UV_USE_IO_URING"
2064+
compile "libuv_io_uring_fix" "$cache_dir" "$env_dir"
2065+
assertCaptured "UV_USE_IO_URING is set to 1"
2066+
assertCapturedSuccess
2067+
}
2068+
20542069
# Utils
20552070

20562071
pushd "$(dirname 0)" >/dev/null

0 commit comments

Comments
 (0)