Skip to content

fix(oxlint/lsp): use blocking stdio in Oxlint#19292

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/02-11-fix_oxlint_lsp_use_blocking_stdio_in_oxlint
Feb 12, 2026
Merged

fix(oxlint/lsp): use blocking stdio in Oxlint#19292
graphite-app[bot] merged 1 commit intomainfrom
om/02-11-fix_oxlint_lsp_use_blocking_stdio_in_oxlint

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Feb 11, 2026

Fixes #19265.

It looks like the cause of the "Resource temporarily unavailable" errors was that NodeJS sets stdin/stdout into non-blocking mode when run from a non-TTY. In non-blocking mode it's possible to fill the stdin / stdout buffers faster than they're consumed, which leads to the error.

The language server communicates with oxlint via piped stdin/stdout, and can exchange a lot of data via these channels.

Solution is to switch to blocking stdio when it's detected that Oxlint is not being run from a TTY.

Oxfmt also ran into the same problem, and has a similar workaround:

// Node.js sets non-TTY `stdio` to non-blocking mode,
// which causes `WouldBlock` errors in Rust when writing large output with `--stdin-filepath`.
// https://github.com/oxc-project/oxc/issues/17939 (issue was on macOS)
//
// As a workaround, if used with pipe, set blocking mode before calling NAPI bindings.
// See: https://github.com/napi-rs/napi-rs/issues/1630
// @ts-expect-error: `_handle` is an internal API
if (!process.stdout.isTTY) process.stdout._handle?.setBlocking?.(true);

In the case of Oxlint-language server, traffic on both stdin and stdout can be voluminous, so I've made both channels blocking (where Oxfmt only makes stdout blocking). I don't know if this is entirely necessary, but it seems better to err on the safe side.


I've tested this PR with both the plugins which were confirmed to cause the problem in #19265. Both now work, and both enabled at the same time also works.


References:

Credit to @camc314 for joining the dots and figuring out that this weird problem was connected to this.

Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-bug Category - Bug labels Feb 11, 2026
@overlookmotel overlookmotel marked this pull request as ready for review February 11, 2026 23:57
Copilot AI review requested due to automatic review settings February 11, 2026 23:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes "Resource temporarily unavailable" errors in the Oxlint language server by setting stdin and stdout to blocking mode when running in non-TTY environments. Node.js sets non-TTY stdio to non-blocking mode by default, which can cause EAGAIN errors when large amounts of data are exchanged via pipes, particularly when loading large JavaScript plugins in the language server.

Changes:

  • Added blocking mode configuration for stdin/stdout in non-TTY environments before calling NAPI bindings
  • Applied similar workaround pattern already used in oxfmt to oxlint CLI
  • Sets both stdin and stdout to blocking (oxfmt only sets stdout) due to bidirectional high-volume communication in language server usage

@overlookmotel overlookmotel requested a review from Sysix February 11, 2026 23:59
Copy link
Member

@Sysix Sysix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enabled stylistic plugin with all its rules in the oxc project and tried with the debug and release build. Now it works 👍

@overlookmotel
Copy link
Member Author

Enabled stylistic plugin with all its rules in the oxc project and tried with the debug and release build. Now it works 👍

Thanks for testing it so thoroughly.

What system were you testing it on? I've tested on MacOS. If you tested on Windows / Linux under WSL, that'd give us even more confidence that this is the definitive fix.

@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Feb 12, 2026
@camc314 camc314 self-assigned this Feb 12, 2026
Copy link
Contributor

camc314 commented Feb 12, 2026

Merge activity

Fixes #19265.

It looks like the cause of the "Resource temporarily unavailable" errors was that NodeJS sets stdin/stdout into non-blocking mode when run from a non-TTY. In non-blocking mode it's possible to fill the stdin / stdout buffers faster than they're consumed, which leads to the error.

The language server communicates with `oxlint` via piped stdin/stdout, and can exchange a lot of data via these channels.

Solution is to switch to blocking stdio when it's detected that Oxlint is not being run from a TTY.

Oxfmt also ran into the same problem, and has a similar workaround:

https://github.com/oxc-project/oxc/blob/87a6724f167740ca116e73bf3f611d94ec7645e0/apps/oxfmt/src-js/cli.ts#L16-L23

In the case of Oxlint-language server, traffic on both stdin and stdout can be voluminous, so I've made both channels blocking (where Oxfmt only makes `stdout` blocking). I don't know if this is entirely necessary, but it seems better to err on the safe side.

---

I've tested this PR with both the plugins which were confirmed to cause the problem in #19265. Both now work, and both enabled at the same time also works.

---

References:

* #17939
* napi-rs/napi-rs#1630

Credit to @camc314 for joining the dots and figuring out that this weird problem was connected to this.
@graphite-app graphite-app bot force-pushed the om/02-11-fix_oxlint_lsp_use_blocking_stdio_in_oxlint branch from 3371681 to 45adda2 Compare February 12, 2026 09:13
@graphite-app graphite-app bot merged commit 45adda2 into main Feb 12, 2026
19 checks passed
@graphite-app graphite-app bot deleted the om/02-11-fix_oxlint_lsp_use_blocking_stdio_in_oxlint branch February 12, 2026 09:19
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Feb 12, 2026
camc314 added a commit that referenced this pull request Feb 12, 2026
# Oxlint
### 🚀 Features

- ebb80b3 ast: Add `node_id` field to all AST struct nodes (#18138)
(Boshen)
- 2879fc5 linter: Implement fixer for unicorn/prefer-math-trunc (#19275)
(camc314)
- a204eda linter: Implement fixer for unicorn/no-typeof-undefined
(#19274) (camc314)
- ab46d9c linter: Implement typescript/class-literal-property-style
(#19252) (Vincent R)
- 1a61f58 linter: Implement typescript/no-invalid-void-type (#19242)
(Vincent R)

### 🐛 Bug Fixes

- 45adda2 oxlint/lsp: Use blocking stdio in Oxlint (#19292)
(overlookmotel)
- 05bc855 linter/import: Count unique module sources in max-dependencies
(#19270) (camc314)
- 8566b44 linter: Check for preceeding token in math trunc fixer
(#19277) (camc314)
- f16f2b6 linter/import-no-cycle: Avoid traversal-order false negatives
with type-only edges (#19267) (camc314)
- d4937e7 linter: Recognize module-scoped callback refs as stable in
exhaustive-deps (#19220) (Sreetam Das)
- 140c9bd linter: Detect fallthrough from `default` when it is not the
last case (#19261) (Boshen)
- 740a009 linter: Accept digits after 'use' in hook names (#19254)
(Sreetam Das)
- 31b562f linter: Update `import/no-named-as-default` to allow named
import if equivalent to the default import (#19100) (connorshea)
- 79c82cc linter: Avoid applying object-level docs to nested object
methods in require-param (#19231) (camc314)

### ⚡ Performance

- 5670291 linter/class-literal-property-style: Avoid unneeded string
allocations (#19262) (camc314)
# Oxfmt
### 🚀 Features

- ebb80b3 ast: Add `node_id` field to all AST struct nodes (#18138)
(Boshen)

### 🐛 Bug Fixes

- 1957908 formatter: Avoid unnecessary parentheses for string literal in
labeled statement (#19272) (Dunqing)

Co-authored-by: camc314 <[email protected]>
Limerio pushed a commit to Limerio/oxc that referenced this pull request Feb 12, 2026
Fixes oxc-project#19265.

It looks like the cause of the "Resource temporarily unavailable" errors was that NodeJS sets stdin/stdout into non-blocking mode when run from a non-TTY. In non-blocking mode it's possible to fill the stdin / stdout buffers faster than they're consumed, which leads to the error.

The language server communicates with `oxlint` via piped stdin/stdout, and can exchange a lot of data via these channels.

Solution is to switch to blocking stdio when it's detected that Oxlint is not being run from a TTY.

Oxfmt also ran into the same problem, and has a similar workaround:

https://github.com/oxc-project/oxc/blob/87a6724f167740ca116e73bf3f611d94ec7645e0/apps/oxfmt/src-js/cli.ts#L16-L23

In the case of Oxlint-language server, traffic on both stdin and stdout can be voluminous, so I've made both channels blocking (where Oxfmt only makes `stdout` blocking). I don't know if this is entirely necessary, but it seems better to err on the safe side.

---

I've tested this PR with both the plugins which were confirmed to cause the problem in oxc-project#19265. Both now work, and both enabled at the same time also works.

---

References:

* oxc-project#17939
* napi-rs/napi-rs#1630

Credit to @camc314 for joining the dots and figuring out that this weird problem was connected to this.
OskarLebuda pushed a commit to OskarLebuda/oxc that referenced this pull request Feb 17, 2026
Fixes oxc-project#19265.

It looks like the cause of the "Resource temporarily unavailable" errors was that NodeJS sets stdin/stdout into non-blocking mode when run from a non-TTY. In non-blocking mode it's possible to fill the stdin / stdout buffers faster than they're consumed, which leads to the error.

The language server communicates with `oxlint` via piped stdin/stdout, and can exchange a lot of data via these channels.

Solution is to switch to blocking stdio when it's detected that Oxlint is not being run from a TTY.

Oxfmt also ran into the same problem, and has a similar workaround:

https://github.com/oxc-project/oxc/blob/87a6724f167740ca116e73bf3f611d94ec7645e0/apps/oxfmt/src-js/cli.ts#L16-L23

In the case of Oxlint-language server, traffic on both stdin and stdout can be voluminous, so I've made both channels blocking (where Oxfmt only makes `stdout` blocking). I don't know if this is entirely necessary, but it seems better to err on the safe side.

---

I've tested this PR with both the plugins which were confirmed to cause the problem in oxc-project#19265. Both now work, and both enabled at the same time also works.

---

References:

* oxc-project#17939
* napi-rs/napi-rs#1630

Credit to @camc314 for joining the dots and figuring out that this weird problem was connected to this.
OskarLebuda pushed a commit to OskarLebuda/oxc that referenced this pull request Feb 17, 2026
# Oxlint
### 🚀 Features

- ebb80b3 ast: Add `node_id` field to all AST struct nodes (oxc-project#18138)
(Boshen)
- 2879fc5 linter: Implement fixer for unicorn/prefer-math-trunc (oxc-project#19275)
(camc314)
- a204eda linter: Implement fixer for unicorn/no-typeof-undefined
(oxc-project#19274) (camc314)
- ab46d9c linter: Implement typescript/class-literal-property-style
(oxc-project#19252) (Vincent R)
- 1a61f58 linter: Implement typescript/no-invalid-void-type (oxc-project#19242)
(Vincent R)

### 🐛 Bug Fixes

- 45adda2 oxlint/lsp: Use blocking stdio in Oxlint (oxc-project#19292)
(overlookmotel)
- 05bc855 linter/import: Count unique module sources in max-dependencies
(oxc-project#19270) (camc314)
- 8566b44 linter: Check for preceeding token in math trunc fixer
(oxc-project#19277) (camc314)
- f16f2b6 linter/import-no-cycle: Avoid traversal-order false negatives
with type-only edges (oxc-project#19267) (camc314)
- d4937e7 linter: Recognize module-scoped callback refs as stable in
exhaustive-deps (oxc-project#19220) (Sreetam Das)
- 140c9bd linter: Detect fallthrough from `default` when it is not the
last case (oxc-project#19261) (Boshen)
- 740a009 linter: Accept digits after 'use' in hook names (oxc-project#19254)
(Sreetam Das)
- 31b562f linter: Update `import/no-named-as-default` to allow named
import if equivalent to the default import (oxc-project#19100) (connorshea)
- 79c82cc linter: Avoid applying object-level docs to nested object
methods in require-param (oxc-project#19231) (camc314)

### ⚡ Performance

- 5670291 linter/class-literal-property-style: Avoid unneeded string
allocations (oxc-project#19262) (camc314)
# Oxfmt
### 🚀 Features

- ebb80b3 ast: Add `node_id` field to all AST struct nodes (oxc-project#18138)
(Boshen)

### 🐛 Bug Fixes

- 1957908 formatter: Avoid unnecessary parentheses for string literal in
labeled statement (oxc-project#19272) (Dunqing)

Co-authored-by: camc314 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linter: JS plugins break language server

3 participants

Comments