Replete
Replete copied to clipboard
Too many open files
Hi :),
First of all, thank you for this gem.
I'm playing with REPLETE and I have found an issue with this simple code while using Openlayers library:
/*jslint browser */
import Map from "ol/Map.js";
import View from "ol/View.js";
import TileLayer from "ol/layer/Tile.js";
import XYZ from "ol/source/XYZ.js";
const map = new Map({
layers: [
new TileLayer({
source: new XYZ({
url: "https://tile.openstreetmap.org/{z}/{x}/{y}.png"
})
})
],
view: new View({
center: [0, 0],
zoom: 2
})
});
export default Object.freeze(map);
after evaluating this code I'm getting:
Waiting for WEBL: http://localhost:3000
WEBL found.
WEBL found.
WEBL found.
error: Uncaught Error: Too many open files (os error 24)
at new FsWatcher (ext:runtime/40_fs_events.js:24:17)
at Object.watchFs (ext:runtime/40_fs_events.js:86:10)
at ext:deno_node/_fs/_fs_watch.ts:57:21
at eventLoopTick (ext:core/01_core.js:203:13)
I suppose this is a file descriptor problem related to node/deno.
Thank you in advance for your help.
Evaluating that snippet results in 157 modules being imported. For each one of those modules, a watcher is created so that Replete will know to reload the file if it is modified. Apparently, 157 watchers is too many for your operating system. May I ask what OS you are using? I have never seen this problem before.
https://github.com/denoland/deno/issues/17757
Hi,
been using Ubuntu 22.04 on Windows via WSL(windows subsystem for linux). Maybe that's the issue.
I'll try to run it on Mac and see how it behaves.
I was able to fix the issue by following this comment. Not sure if it's an appropriate solution, but seems like it fixes the issue.
I think the real problem is that Deno's watch is more profligate with file descriptors than Node's watch. It is easy to imagine a REPL session where several thousand modules have been imported.
The latest version of Replete, 0.0.15, handles watch exceptions gracefully. The exception is written to the output, but no longer prevents evaluation. Modules that can not be watched will not be cached, incurring a performance penalty, but at least it will work.
Could you please test this change with your original inotify configuration?
Sure.
Maybe I'm missing something, this is my basic setup. I've reverted inotify configuration back to 128. The error persists.
It seems that this exception can not be caught after all, owing to some very questionable code: https://github.com/denoland/deno/blob/61f1b8e8dc20846093a8b24a8f511a09bbf09919/ext/node/polyfills/_fs/_fs_watch.ts#L118-L124.
I've left a comment on https://github.com/denoland/deno/issues/17757.
Thank you!