nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
106.43k stars 29.01k forks source link

Node 22 node-gyp build fails "Text file busy" #53051

Open kode54 opened 3 months ago

kode54 commented 3 months ago

Version

v22.0.0

Platform

Linux laharl 6.9.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 17 May 2024 16:56:38 +0000 x86_64 GNU/Linux

Subsystem

node-gyp

What steps will reproduce the bug?

1) Attempted to build thelounge from AUR package 2) sqlite3 submodule fails with two "/usr/bin/env: 'node': Text file busy" errors

How often does it reproduce? Is there a required condition?

It happens every time. It appears to be a race condition with io_uring with kernel 6.9.x on x86_64.

What is the expected behavior? Why is that the expected behavior?

The packages should build properly.

What do you see instead?

Two of the node-gyp build steps fail:

/usr/bin/env: 'node': Text file busy
/usr/bin/env: 'node': Text file busy

Additional information

I am re-reporting this issue because it does not involve use of Docker. Currently, thelounge package has added a workaround to disable io_uring in libuv to allow the build to pass.

Edit 1: Related bug reports have suggested this is only a problem because Arch builds nodejs against the system libuv, which it configures with the defaults, which enable io_uring support.

A kernel fix is slated for 6.9.2 that will likely work around the errors, but will not work around Arch or other distributions which have not disabled io_uring support in libuv like node has for security reasons. However, I am not sure how much of a threat model the io_uring support is, considering it's probably not that wise to be running node suid/sgid in the first place.

dax-dot-gay commented 3 months ago

Also having this issue (running node through yarn on arch, kernel version 6.9.1), since a kernel upgrade yesterday.

victormamede commented 3 months ago

Same problem on arch after upgrading the kernel, any type of yarn run triggers the error

7Z0nE commented 3 months ago

On my system any execution of yarn triggers this error with node v22.0.0

Kocicak commented 3 months ago

Hello, after downgrading kernel to 6.8.9, the problem went away.

santigimeno commented 3 months ago

Can you please open an issue in https://github.com/libuv/libuv/issues with the specific kernel version/s so we can blacklist them? Thanks

kvaster commented 3 months ago

I've made kernel bisect.

the last good commit: 2708af1adc11700c6c3ce4109e3b133079a36a78 the first bad commit: af5d68f8892f8ee8f137648b79ceb2abc153a19b

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=af5d68f8892f8ee8f137648b79ceb2abc153a19b

Tatsh commented 3 months ago

Also confirming it is definitely af5d68f8892f8ee8f137648b79ceb2abc153a19b after bisecting myself.

Tatsh commented 3 months ago

There is a kernel patch for those interested. Otherwise this will probably be fixed in 6.9.2.

naskya commented 3 months ago

The same issue happens with Node v18 and v20.

$ node --version
v18.20.3

$ npm --version
10.8.0

$ uname --all
Linux localhost 6.9.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 17 May 2024 16:56:38 +0000 x86_64 GNU/Linux

$ npm install bufferutil
npm error code 126
npm error path /home/naskya/node_modules/bufferutil
npm error command failed
npm error command sh -c node-gyp-build
npm error sh: /home/naskya/node_modules/.bin/node-gyp-build: /usr/bin/env: bad interpreter: Text file busy
npm error A complete log of this run can be found in: /home/naskya/.npm/_logs/2024-05-22T08_46_40_033Z-debug-0.log

zen-kernel is unaffected.

$ node --version            
v18.20.3

$ npm --version             
10.8.0

$ uname --all
Linux localhost 6.9.1-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Fri, 17 May 2024 16:56:18 +0000 x86_64 GNU/Linux

$ npm install bufferutil  

added 2 packages in 1s
kode54 commented 3 months ago

I have updated the main bug comment with some extra information, indicated with an "Edit" marker above the text. Mainly to hopefully be seen by anyone just arriving at the bug.

ivan770 commented 3 months ago

As a temporary workaround it's also possible to use the UV_USE_IO_URING environment variable to disable io_uring support in libuv: UV_USE_IO_URING=0 yarn add bufferutil

Gabriel-Grechuk commented 3 months ago

I don't know if this will help someone, but I'm able to run with no problems after downgrading the node to the version 21.7.3 with the kernel 6.9.1-arch1-1. Don't know if it works for every application though

WasathTheekshana commented 3 months ago

Same issue :(

Kernel Version = 6.9.1 Node Version = 21.0.0

screenshot_26052024_011257

WasathTheekshana commented 3 months ago

I don't know if this will help someone, but I'm able to run with no problems after downgrading the node to the version 21.7.3 with the kernel 6.9.1-arch1-1. Don't know if it works for every application though

This solved my problem. Thanks <3

MartinX3 commented 3 months ago

Still an issue with kernel 6.9.2.

Garubieru commented 3 months ago

kernel 6.9.3 seems to fix this issue.