Skip to content

Disable io_uring use in libuv #1347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/[email protected]/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