DeterminateSystems / nix-installer-action

The Github Action for the Determinate Nix Installer
https://github.com/determinateSystems/nix-installer
GNU Lesser General Public License v2.1
158 stars 16 forks source link

`ETXTBSY` on `execute_install()` #51

Closed Kiskae closed 10 months ago

Kiskae commented 10 months ago

Recently been getting run failures with an Error: spawn ETXTBSY error.

Tracking down the source appears to show https://github.com/DeterminateSystems/nix-installer-action/blob/721f94f7df2665d750964b01ac153ce9c1151e57/src/main.ts#L268-L270 failing and causing an uncaught exception to propagate through the action.

This specific failure reminds me of the race condition mentioned in the README of https://github.com/buildbarn/bb-remote-execution - requiring separate processes to handle downloading of an executable and executing that executable.

  • To work around https://github.com/golang/go/issues/22315 that effectively prevents multi-threaded processes from writing executables to disk and spawning them. Through this decomposition, bb_worker writes executables to disk, while bb_runner spawns them.

Excerpt from workflow log:

2023-11-02T13:53:48.8844243Z ##[group]Run DeterminateSystems/nix-installer-action@v6
2023-11-02T13:53:48.8844899Z with:
2023-11-02T13:53:48.8845200Z   flakehub: false
2023-11-02T13:53:48.8845821Z   github-token: ***
2023-11-02T13:53:48.8846200Z   modify-profile: true
2023-11-02T13:53:48.8846748Z   reinstall: false
2023-11-02T13:53:48.8847092Z   start-daemon: true
2023-11-02T13:53:48.8847777Z   diagnostic-endpoint: https://install.determinate.systems/nix/diagnostic
2023-11-02T13:53:48.8848606Z   trust-runner-user: true
2023-11-02T13:53:48.8848997Z ##[endgroup]
2023-11-02T13:53:49.0060064Z Fetching binary from https://install.determinate.systems/nix/nix-installer-x86_64-linux?ci=github&correlation=GH-599763b2-1658-467b-abe6-984a90a66e96
2023-11-02T13:53:49.5869054Z Downloaded `nix-installer` to `/tmp/nix-installer-7iB0Nw/nix-installer-x86_64-linux`
2023-11-02T13:53:49.5897493Z Execution environment: {
2023-11-02T13:53:49.5903883Z     "NIX_INSTALLER_NO_CONFIRM": "true",
2023-11-02T13:53:49.5904829Z     "NIX_INSTALLER_DIAGNOSTIC_ATTRIBUTION": "GH-599763b2-1658-467b-abe6-984a90a66e96",
2023-11-02T13:53:49.5905559Z     "NIX_INSTALLER_MODIFY_PROFILE": "true",
2023-11-02T13:53:49.5906364Z     "NIX_INSTALLER_DIAGNOSTIC_ENDPOINT": "https://install.determinate.systems/nix/diagnostic",
2023-11-02T13:53:49.5907140Z     "NIX_INSTALLER_START_DAEMON": "true",
2023-11-02T13:53:49.5909417Z     "NIX_INSTALLER_EXTRA_CONF": "access-tokens = github.com=***\ntrusted-users = root runner\n"
2023-11-02T13:53:49.5910164Z }
2023-11-02T13:53:49.6049345Z ##[error]Error: spawn ETXTBSY
2023-11-02T13:53:49.6219046Z Post job cleanup.
Hoverbear commented 10 months ago

Thanks for the report!

@colemickens prepared a possible fix with https://github.com/DeterminateSystems/nix-installer-action/pull/47, I'll be cutting that this morning.

Kiskae commented 10 months ago

I'm not sure how useful it would be, but perhaps the error should be propagated instead of going through the uncaught exception handler?

https://github.com/DeterminateSystems/nix-installer-action/blob/721f94f7df2665d750964b01ac153ce9c1151e57/src/main.ts#L288-L290

const exit_code: number = await new Promise((resolve, reject) => {
  spawned.on("close", resolve);
  spawned.on("error", reject);
});

EDIT: might need to replace close with exit, since close gets emitted after error or exit

Kiskae commented 10 months ago

Haven't seen the error since updating the action, will reopen if it shows up again.

Hoverbear commented 10 months ago

Great!