Skip to content

fix(cli): handle EMFILE/ENOSPC in file watchers with polling fallback#323

Closed
noahkhomer18 wants to merge 1 commit into
withastro:mainfrom
noahkhomer18:fix/314-emfile-watcher
Closed

fix(cli): handle EMFILE/ENOSPC in file watchers with polling fallback#323
noahkhomer18 wants to merge 1 commit into
withastro:mainfrom
noahkhomer18:fix/314-emfile-watcher

Conversation

@noahkhomer18

Copy link
Copy Markdown

When fs.watch() throws EMFILE or ENOSPC due to system file watcher limits being exhausted, the dev server would crash before starting. Now each watcher is wrapped in its own try/catch, and resource errors fall back to polling (stat-based) change detection with a 1-second interval. Non-resource errors still fail fast.

Applies to:

  • Config file watchers in flue.ts (config directory watches)
  • Recursive root watcher in dev.ts (project file watching)
  • Environment file watcher in dev.ts (.env changes)

Closes #314

When fs.watch() throws EMFILE or ENOSPC due to system file watcher
limits being exhausted, the dev server would crash before starting.
Now each watcher is wrapped in its own try/catch, and resource
errors fall back to polling (stat-based) change detection with a
1-second interval. Non-resource errors still fail fast.

Applies to:
- Config file watchers in flue.ts (config directory watches)
- Recursive root watcher in dev.ts (project file watching)
- Environment file watcher in dev.ts (.env changes)

Closes withastro#314
@astrobot-houston

Copy link
Copy Markdown

Thanks for the contribution! We're closing this PR and moving the conversation to the issue: #324

We've moved to a model where bugs and feature proposals are discussed in issues/discussions before code review, so the community can help prioritize and shape the work. Your branch is linked from the new thread so the implementation isn't lost — please join us there to continue the conversation.

— astrobot 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flue dev crashes with EMFILE when system hits file watcher limits

2 participants