Skip to content

Commit

Permalink
Disable io_uring use in libuv (#1347)
Browse files Browse the repository at this point in the history
* Disable `io_uring` use in `libuv`

amazonlinux/amazon-linux-2023#840 (comment)

* Update CHANGELOG.md
  • Loading branch information
colincasey authored Nov 20, 2024
1 parent ab48938 commit 719479b
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]

- 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))

## [v270] - 2024-11-13

Expand Down
13 changes: 13 additions & 0 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ export PATH="$BUILD_DIR/.heroku/node/bin:$BUILD_DIR/.heroku/yarn/bin":$PATH
export COREPACK_HOME="$BUILD_DIR/.heroku/corepack"
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0

# 2024-11-20:
# We started getting reports on build timeouts on the platform that were unexpected
# due to the specific versions on Node.js and npm which had been working fine up until
# this date. After some extensive digging, we believe we narrowed down the cause to
# a bug in io_uring that affects the Amazon Linux 2023 release. There is a pending fix
# which will be released around Dec. 9th but, until then, the workaround is set disable
# the use of io_uring in libuv.
#
# See https://github.com/npm/cli/issues/7814#issuecomment-2488626736
# → https://github.com/amazonlinux/amazon-linux-2023/issues/840#issuecomment-2485782075
# → https://lore.kernel.org/io-uring/3d913aef-8c44-4f50-9bdf-7d9051b08941@app.fastmail.com/T/#m57570b5f8f2fc00d5a17cfe18ffeeba9fc23a43d
export UV_USE_IO_URING=${UV_USE_IO_URING:-0}

LOG_FILE=$(mktemp -t node-build-log.XXXXX)
echo "" > "$LOG_FILE"

Expand Down
1 change: 1 addition & 0 deletions test/fixtures/libuv_io_uring_fix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A fake README, to keep npm from polluting stderr.
15 changes: 15 additions & 0 deletions test/fixtures/libuv_io_uring_fix/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "libuv-uring-fix",
"version": "0.0.1",
"description": "node buildpack integration test app",
"repository" : {
"type" : "git",
"url" : "http://github.com/example/example.git"
},
"engines": {
"node": "22.x"
},
"scripts": {
"build": "echo \"UV_USE_IO_URING is set to $UV_USE_IO_URING\""
}
}
15 changes: 15 additions & 0 deletions test/run
Original file line number Diff line number Diff line change
Expand Up @@ -2051,6 +2051,21 @@ testConflictingPackageManagerMetadata() {
assertCapturedError
}

testDisableIoUringFix() {
compile "libuv_io_uring_fix"
assertCaptured "UV_USE_IO_URING is set to 0"
assertCapturedSuccess
}

testDisableIoUringFixUserOverride() {
cache_dir=$(mktmpdir)
env_dir=$(mktmpdir)
echo "1" > "$env_dir/UV_USE_IO_URING"
compile "libuv_io_uring_fix" "$cache_dir" "$env_dir"
assertCaptured "UV_USE_IO_URING is set to 1"
assertCapturedSuccess
}

# Utils

pushd "$(dirname 0)" >/dev/null
Expand Down

0 comments on commit 719479b

Please sign in to comment.