berry icon indicating copy to clipboard operation
berry copied to clipboard

[Bug]: scripts fail with Linux 6.9.0-6.9.2: ETXTBSY

Open demurgos opened this issue 1 year ago • 12 comments

Self-service

  • [X] I'd be willing to implement a fix

Describe the bug

The package es5-ext can't be install using Yarn:

The reason is that it contains a postinstall script that fails with the following error:

# This file contains the result of Yarn building a package (es5-ext@npm:0.10.64)
# Script name: postinstall                                                                                                                                                                                                       
                                                                                                                                                                                                                                 
Error: spawn ETXTBSY                                                                                                                                                                                                             
    at ChildProcess.spawn (node:internal/child_process:421:11)                                                                                                                                                                   
    at Object.spawn (node:child_process:760:9)                                                                                                                                                                                   
    at JY (/data/projects/eternal-twin/popotamo/.yarn/releases/yarn-4.2.2.cjs:9:52616)                                                                                                                                           
    at LE.implementation (/data/projects/eternal-twin/popotamo/.yarn/releases/yarn-4.2.2.cjs:159:1348)                                                                                                                           
    at LE.exec (/data/projects/eternal-twin/popotamo/.yarn/releases/yarn-4.2.2.cjs:165:1414)                                                                                                                                     
    at LE.run (/data/projects/eternal-twin/popotamo/.yarn/releases/yarn-4.2.2.cjs:165:1585)                                                                                                                                      
    at oce (/data/projects/eternal-twin/popotamo/.yarn/releases/yarn-4.2.2.cjs:165:7428)                                                                                                                                         
    at async Eot (/data/projects/eternal-twin/popotamo/.yarn/releases/yarn-4.2.2.cjs:167:16)                                                                                                                                     
    at async u (/data/projects/eternal-twin/popotamo/.yarn/releases/yarn-4.2.2.cjs:167:147)                                                                                                                                      
    at async Cot (/data/projects/eternal-twin/popotamo/.yarn/releases/yarn-4.2.2.cjs:168:14)               

To reproduce

await packageJsonAndInstall({
  dependencies: {
    [`es5-ext`]: `0.10.64`,
  },
});

Environment

System:
  OS: Linux 6.9 Arch Linux
  CPU: (32) x64 AMD Ryzen 9 7950X 16-Core Processor
Binaries:
  Node: 22.2.0 - /usr/bin/node
  Yarn: 4.2.2 - /usr/bin/yarn
  npm: N/A

Additional context

This also fails with Yarn 1.22.22 when running it inside the es5-next repo.

git clone https://github.com/medikoo/es5-ext.git
cd es5-next
yarn run postinstall

The error is:

yarn run v1.22.22
$  node -e "try{require('./_postinstall')}catch(e){}" || exit 0
/bin/sh: /tmp/yarn--1716498028617-0.6802456915004955/node: /bin/sh: bad interpreter: Text file busy
Done in 0.12s.

The value for the postinstall script is " node -e \"try{require('./_postinstall')}catch(e){}\" || exit 0" (with a leading space, removing it does not fix the issue).

EDIT: I downloaded npm 10.8.0 since then, running the postinstall script through npm works.

demurgos avatar May 23 '24 23:05 demurgos

The reproduction case in your issue seems broken (ie it neither pass nor fail due to throwing an unmanaged exception):

Error: Command failed: /usr/bin/node /github/workspace/scripts/actions/../run-yarn.js install

➤ YN0000: · Yarn 4.2.2-dev
➤ YN0000: ┌ Resolution step
::group::Resolution step
➤ YN0035: │ es5-next@npm:0.10.64: Package not found
➤ YN0035: │   Response Code: 404 (Not Found)
➤ YN0035: │   Request Method: GET
➤ YN0035: │   Request URL: https://registry.yarnpkg.com/es5-next
::endgroup::
➤ YN0035: es5-next@npm:0.10.64: Package not found
➤ YN0035:   Response Code: 404 (Not Found)
➤ YN0035:   Request Method: GET
➤ YN0035:   Request URL: https://registry.yarnpkg.com/es5-next
➤ YN0000: └ Completed in 0s 462ms
➤ YN0000: · Failed with errors in 0s 496ms

    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:517:28)
    at maybeClose (node:internal/child_process:1098:16)
    at ChildProcess._handle.onexit (node:internal/child_process:303:5)

Remember: any non-Jest exceptions will cause the test to be reported as broken. If you expect something to pass without throwing, you must wrap it into something like await expect(...).resolves.toBeTruthy(). If you instead expect something to throw, you need to wrap it into await expect(...).rejects.toThrow().

yarnbot avatar May 23 '24 23:05 yarnbot

The reproduction case in your issue seems broken (ie it neither pass nor fail due to throwing an unmanaged exception):

Error: Command failed: /usr/bin/node /github/workspace/scripts/actions/../run-yarn.js install

➤ YN0000: · Yarn 4.2.2-dev
➤ YN0000: ┌ Resolution step
::group::Resolution step
➤ YN0035: │ es5-next@npm:0.10.64: Package not found
➤ YN0035: │   Response Code: 404 (Not Found)
➤ YN0035: │   Request Method: GET
➤ YN0035: │   Request URL: https://registry.yarnpkg.com/es5-next
::endgroup::
➤ YN0035: es5-next@npm:0.10.64: Package not found
➤ YN0035:   Response Code: 404 (Not Found)
➤ YN0035:   Request Method: GET
➤ YN0035:   Request URL: https://registry.yarnpkg.com/es5-next
➤ YN0000: └ Completed in 0s 379ms
➤ YN0000: · Failed with errors in 0s 412ms

    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:517:28)
    at maybeClose (node:internal/child_process:1098:16)
    at ChildProcess._handle.onexit (node:internal/child_process:303:5)

Remember: any non-Jest exceptions will cause the test to be reported as broken. If you expect something to pass without throwing, you must wrap it into something like await expect(...).resolves.toBeTruthy(). If you instead expect something to throw, you need to wrap it into await expect(...).rejects.toThrow().

yarnbot avatar May 23 '24 23:05 yarnbot

We couldn't reproduce your issue (all the assertions passed on master).

yarnbot avatar May 23 '24 23:05 yarnbot

We couldn't reproduce your issue (all the assertions passed on master).

yarnbot avatar May 24 '24 00:05 yarnbot

After more investigations, I found the following:

  • The error occurs when spawning a Node 22 process, it works with Node 20 (even if the caller is Node 22, it's the version of the binary called inside the script that matters)
  • This error occurs for all scripts, even local ones as simple as "node -e \"console.log(1)\"".

demurgos avatar May 24 '24 00:05 demurgos

More edits:

  • Looks like it fails when invoking the version 22.2.0 at /usr/bin/node (installed from the Arch packages).
  • It works when invoking Node 22.2.0 installed though NVM (/home/demurgos/.nvm/versions/node/v22.2.0/bin/node)

It may be some issue related to the version packaged by Arch/how it was installed.

demurgos avatar May 24 '24 00:05 demurgos

seeing this as well on arch. I can add its hitting protoc and browser-tabs-lock as well. going to add results of some of my experiments here.

setup:

podman pull archlinux
podman run --name archtest -d archlinux:latest /sbin/init
podman exec -it archtest pacman -Syu nodejs-lts-iron vim
podman exec -it archtest /bin/bash

rebuilding a sample from scratch in a container seems to avoid the issue.

mkdir test1 && cd test1
corepack use yarn@stable
corepack yarn add --dev protoc

running the same test as usual user causes the issue:

corepack yarn add --dev protoc
➤ YN0000: · Yarn 4.2.2
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0007: │ protoc@npm:1.1.3 must be built because it never has been before or the last one failed
➤ YN0009: │ protoc@npm:1.1.3 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-f01aceee/build.log)
➤ YN0000: └ Completed
➤ YN0000: · Failed with errors in 0s 68ms

creating a new user locally: fails as well but the output changes slightly mentioning an experimental api in use. but the error in the log is the same.

corepack yarn add --dev protoc
➤ YN0000: · Yarn 4.2.2
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ protoc@npm:1.1.3 must be built because it never has been before or the last one failed
➤ YN0009: │ protoc@npm:1.1.3 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-d695e789/build.log)
➤ YN0000: └ Completed
➤ YN0000: · Failed with errors in 0s 65ms

same test in a fresh VM:

corepack yarn add --dev protoc
➤ YN0000: · Yarn 4.2.2
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ protoc@npm:1.1.3 must be built because it never has been before or the last one failed
➤ YN0009: │ protoc@npm:1.1.3 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-791de93f/build.log)
➤ YN0000: └ Completed
➤ YN0000: · Failed with errors in 0s 65ms

definitely feels like an issue with the arch packages. I'm not sure on the node version mattering I down graded to v18 for node and ran into the issue still.

james-lawrence avatar May 27 '24 12:05 james-lawrence

This is an issue with Arch linux package https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/issues/55

Temporary fix

UV_USE_IO_URING=0

Crandel avatar May 27 '24 12:05 Crandel

ah wonderful was just about to report upstream. (can confirm UV_USE_IO_URING=0 resolves it)

james-lawrence avatar May 27 '24 12:05 james-lawrence

We couldn't reproduce your issue (all the assertions passed on master).

yarnbot avatar May 30 '24 18:05 yarnbot

We couldn't reproduce your issue (all the assertions passed on master).

yarnbot avatar May 30 '24 18:05 yarnbot

We couldn't reproduce your issue (all the assertions passed on master).

yarnbot avatar Jun 01 '24 07:06 yarnbot