Skip to content

unhandled EAGAIN from NodeJS' writeSync #362

@PAStheLoD

Description

@PAStheLoD

Hello!

I've run into a strange problem with the following code (which worked perfectly for ~2 weeks as part of a CI script, now and today suddenly after ~800 lines of output), one of the pipes was not able to keep up and Node's writeSync threw an EAGAIN.

await $`docker compose build ${service}`
      .env({ COMPOSE_BAKE: "true" })
      .stdout("inheritPiped")
      .stderr("inheritPiped")
      .captureCombined();
node:fs:912
  handleErrorFromBinding(ctx);
  ^
Error: EAGAIN: resource temporarily unavailable, write
    at writeSync (node:fs:912:3)
    at Object.writeSync (file:///opt/node_modules/.pnpm/@deno+shim-deno@0.19.2/node_modules/@deno/shim-deno/dist/index.mjs:642:12)
    at CapturingBufferWriterSync.writeSync (file:///opt/node_modules/.pnpm/dax@0.45.0/node_modules/dax/esm/mod.js:6727:40)
    at CapturingBufferWriterSync.writeSync (file:///opt/node_modules/.pnpm/dax@0.45.0/node_modules/dax/esm/mod.js:6727:40)
    at writeAllSync2 (file:///opt/node_modules/.pnpm/dax@0.45.0/node_modules/dax/esm/mod.js:3506:24)
    at ShellPipeWriter.writeAll (file:///opt/node_modules/.pnpm/dax@0.45.0/node_modules/dax/esm/mod.js:6690:14)
    at pipeReadableToWriterSync (file:///opt/node_modules/.pnpm/dax@0.45.0/node_modules/dax/esm/mod.js:6863:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
    at async readStdOutOrErr (file:///opt/node_modules/.pnpm/dax@0.45.0/node_modules/dax/esm/mod.js:7010:3)
    at async Promise.all (index 1) {
  errno: -11,
  syscall: 'write',
  code: 'EAGAIN'
}
Node.js v25.8.0

CapturingBufferWriterSync.writeSync is here, where a loop might make sense. (Or maybe it should go into shim-deno. I see there's at least one EAGAIN issue there, but I have no idea what's Deno's "API contract" for writeSync, is it supposed to retry on EAGAIN automatically or not.)

Thanks for (dax and for) your time and attention!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions