Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle ENOSPC error from chokidar #2725

Merged
merged 3 commits into from
Aug 8, 2024

Conversation

Its-treason
Copy link
Member

Now listens to the error event to check if "ENOSPC" occurs. The watcher will then automatically restart in polling mode, so that the user still sees his requests / collections.

Fixes: #1877

Now listens to the error event to check if "ENOSPC" occurrs.
The watcher will then automaticly restart in polling mode, so that
the user still sees his reqeusts / collections.

Fixes: usebruno#1877
@sanjai0py
Copy link
Member

Hey @Its-treason, thanks again for taking the time to fix this issue. The code changes look good. We are currently testing the changes and will get this merged soon!

@pull-request-size pull-request-size bot added size/M and removed size/S labels Aug 7, 2024
@helloanoop helloanoop merged commit 1e0c88a into usebruno:main Aug 8, 2024
2 checks passed
@helloanoop
Copy link
Contributor

Merged! Thanks @Its-treason for adding helpful messages in the code.

@fritz-trawa
Copy link

What release is that part of? Because I have just installed Bruno and I still get the error. OS X, v1.25.0

@Its-treason
Copy link
Member Author

What release is that part of? Because I have just installed Bruno and I still get the error. OS X, v1.25.0

In 1.25.0 Could you start Bruno inside your Terminal and check what the error message / code is?

@fritz-trawa
Copy link

You mean with open /Applications/Bruno.app/Contents/MacOS/Bruno ?

I tried and I noticed there are a lot of

watcher add: /Users/fritz....
An error occurred in the watcher for: /Users/fritz.... Error: EMFILE: too many open files, watch '/Users/fritz....'
    at FSWatcher.<computed> (node:internal/fs/watchers:247:19)
    at Object.watch (node:fs:2469:36)
    at createFsWatchInstance (/Applications/Bruno.app/Contents/Resources/app.asar/node_modules/chokidar/lib/nodefs-handler.js:119:15)
    at setFsWatchListener (/Applications/Bruno.app/Contents/Resources/app.asar/node_modules/chokidar/lib/nodefs-handler.js:166:15)
    at NodeFsHandler._watchWithNodeFs (/Applications/Bruno.app/Contents/Resources/app.asar/node_modules/chokidar/lib/nodefs-handler.js:331:14)
    at NodeFsHandler._handleFile (/Applications/Bruno.app/Contents/Resources/app.asar/node_modules/chokidar/lib/nodefs-handler.js:395:23)
    at NodeFsHandler._addToNodeFs (/Applications/Bruno.app/Contents/Resources/app.asar/node_modules/chokidar/lib/nodefs-handler.js:637:21) {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  path: '/Users/fritz....',
  filename: '/Users/fritz....'
}

And then I noticed I have a lot of json files in the same folder (the result of past test runs). Moving them resolves the issue, thanks. But I am not sure why Bruno is watching json files, shouldn't it limit itself to .bru?

Regardless, problem solved, thanks for your quick reply

@Its-treason
Copy link
Member Author

Its-treason commented Aug 20, 2024

You mean with open /Applications/Bruno.app/Contents/MacOS/Bruno ?

I tried and I noticed there are a lot of

watcher add: /Users/fritz....
An error occurred in the watcher for: /Users/fritz.... Error: EMFILE: too many open files, watch '/Users/fritz....'
    at FSWatcher.<computed> (node:internal/fs/watchers:247:19)
    at Object.watch (node:fs:2469:36)
    at createFsWatchInstance (/Applications/Bruno.app/Contents/Resources/app.asar/node_modules/chokidar/lib/nodefs-handler.js:119:15)
    at setFsWatchListener (/Applications/Bruno.app/Contents/Resources/app.asar/node_modules/chokidar/lib/nodefs-handler.js:166:15)
    at NodeFsHandler._watchWithNodeFs (/Applications/Bruno.app/Contents/Resources/app.asar/node_modules/chokidar/lib/nodefs-handler.js:331:14)
    at NodeFsHandler._handleFile (/Applications/Bruno.app/Contents/Resources/app.asar/node_modules/chokidar/lib/nodefs-handler.js:395:23)
    at NodeFsHandler._addToNodeFs (/Applications/Bruno.app/Contents/Resources/app.asar/node_modules/chokidar/lib/nodefs-handler.js:637:21) {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  path: '/Users/fritz....',
  filename: '/Users/fritz....'
}

And then I noticed I have a lot of json files in the same folder (the result of past test runs). Moving them resolves the issue, thanks. But I am not sure why Bruno is watching json files, shouldn't it limit itself to .bru?

Regardless, problem solved, thanks for your quick reply

The EMFILE error code will be handled in the next released. My follow-up PR was merged a few days ago: #2789

I'm also not sure why Bruno watches all files, instead of just needed ones, but this could probably be optimised later.

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

Successfully merging this pull request may close these issues.

Could not see Bru file in collection
4 participants