Skip to content

Commit 176cfa9

Browse files
Disable io_uring use in libuv (heroku#1347) (#12)
* Disable `io_uring` use in `libuv` amazonlinux/amazon-linux-2023#840 (comment) * Update CHANGELOG.md Co-authored-by: Colin Casey <[email protected]>
1 parent f97a373 commit 176cfa9

File tree

5 files changed

+46
-0
lines changed

5 files changed

+46
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## main
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))
6+
57
## v232 (2023-12-07)
68

79
- Added Node.js version 21.4.0.

bin/compile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,19 @@ source "$BP_DIR/lib/yarn-2.sh"
6161

6262
export PATH="$BUILD_DIR/.heroku/node/bin:$BUILD_DIR/.heroku/yarn/bin":$PATH
6363

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

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
@@ -1535,6 +1535,21 @@ testUseNpm10() {
15351535
assertCapturedSuccess
15361536
}
15371537

1538+
testDisableIoUringFix() {
1539+
compile "libuv_io_uring_fix"
1540+
assertCaptured "UV_USE_IO_URING is set to 0"
1541+
assertCapturedSuccess
1542+
}
1543+
1544+
testDisableIoUringFixUserOverride() {
1545+
cache_dir=$(mktmpdir)
1546+
env_dir=$(mktmpdir)
1547+
echo "1" > "$env_dir/UV_USE_IO_URING"
1548+
compile "libuv_io_uring_fix" "$cache_dir" "$env_dir"
1549+
assertCaptured "UV_USE_IO_URING is set to 1"
1550+
assertCapturedSuccess
1551+
}
1552+
15381553
# Utils
15391554

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

0 commit comments

Comments
 (0)