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

EMFILE exception when watching on Win7 #21

Open
janderland opened this issue Mar 15, 2016 · 2 comments
Open

EMFILE exception when watching on Win7 #21

janderland opened this issue Mar 15, 2016 · 2 comments

Comments

@janderland
Copy link

On my Window 7 system, the "hexo server" command will usually crash with the EMFILE error. I say usually because if I run "hexo clean && hexo server" enough times then it eventually works. Below is my cmd shell dump...

C:\Users\andjon\Source\janderland>hexo server --debug
02:16:47.479 DEBUG Hexo version: 3.2.0
02:16:47.479 DEBUG Working directory: ~\Source\janderland
02:16:47.572 DEBUG Config loaded: ~\Source\janderland_config.yml
02:16:47.588 DEBUG Plugin loaded: hexo-renderer-marked
02:16:47.588 DEBUG Plugin loaded: hexo-generator-index
02:16:47.588 DEBUG Plugin loaded: hexo-generator-archive
02:16:47.588 DEBUG Plugin loaded: hexo-renderer-ejs
02:16:47.603 DEBUG Plugin loaded: hexo-generator-category
02:16:47.603 DEBUG Plugin loaded: hexo-generator-tag
02:16:47.635 DEBUG Plugin loaded: hexo-server
02:16:47.650 DEBUG Loading database.
02:16:47.650 INFO Start processing
02:16:48.430 DEBUG Theme config loaded.
02:16:48.430 DEBUG Processed: _config.yml
02:16:48.430 DEBUG Processed: source/css/foundation-icons.css
02:16:48.430 DEBUG Processed: source/css/foundation-icons.eot
02:16:48.446 DEBUG Processed: source/css/foundation-icons.ttf
02:16:48.446 DEBUG Processed: source/css/foundation-icons.woff
02:16:48.446 DEBUG Processed: source/css/jander.css
02:16:48.446 DEBUG Processed: source/js/index.js
02:16:48.446 DEBUG Processed: source/js/app.js
02:16:48.539 DEBUG Processed: layout/index.ejs
02:16:48.539 DEBUG Processed: layout/layout.ejs
02:16:48.555 DEBUG Processed: source/css/foundation.css
02:16:48.851 DEBUG Processed: layout/post.ejs
02:16:48.851 DEBUG Processed: source/css/foundation-icons.svg
02:16:48.961 DEBUG Processed: layout/_partials/css.ejs
02:16:48.961 DEBUG Processed: layout/_partials/js.ejs
02:16:48.961 DEBUG Processed: layout/_partials/list_posts.ejs
02:16:48.961 DEBUG Processed: _posts/Test.md
02:16:48.961 DEBUG Processed: _posts/This-is-a-dummy-post.md
02:16:48.961 DEBUG Processed: _posts/Heyo.md
02:16:48.961 DEBUG Processed: _posts/What-up-punks.md
fs.js:584
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^

Error: EMFILE: too many open files, open 'C:\Users\andjon\Source\janderland\node_modules\readdirp\stream-api.js'
at Error (native)
at Object.fs.openSync (fs.js:584:18)
at Object.fs.readFileSync (fs.js:431:33)
at Object.Module._extensions..js (module.js:421:20)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at readdir (C:\Users\andjon\Source\janderland\node_modules\readdirp\readdirp.js:52:25)
at FSWatcher. (C:\Users\andjon\Source\janderland\node_modules\chokidar\lib\nodefs-handler.js:355:5)
at FSWatcher.NodeFsHandler._handleDir (C:\Users\andjon\Source\janderland\node_modules\chokidar\lib\nodefs-handler.js:406:18)
at FSWatcher. (C:\Users\andjon\Source\janderland\node_modules\chokidar\lib\nodefs-handler.js:455:19)
at FSWatcher. (C:\Users\andjon\Source\janderland\node_modules\chokidar\lib\nodefs-handler.js:460:16)
at FSReqWrap.oncomplete (fs.js:82:15)

I tested the exact same hexo site on my Macbook and an EMFILE error is never thrown.

Notice that the EMFILE error actually occur's during a require() call by the readdirp module. One possible solution could be to 'gracefulify' the fs module during the hexo-fs module's initialization...

var fs = require('graceful-fs'); var nodeFs = require('fs'); fs.gracefulify(nodeFs);

... though I haven't tested the effects this would have on performance.

@yangg
Copy link

yangg commented Jul 14, 2016

Same problem, anyone can fix it?

@NoahDragon
Copy link
Member

https://hexo.io/docs/troubleshooting.html#EMFILE-Error

Thanks for your feed back. Hexo won't handle system I/O. People also raising similar issue on windows bash microsoft/WSL#1126 . They provide some solution, hope that would help.

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

No branches or pull requests

3 participants