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 error appears in iojs v1.2.0 on Windows #3984

Closed
miklen opened this issue Nov 23, 2015 · 14 comments
Closed

EMFILE error appears in iojs v1.2.0 on Windows #3984

miklen opened this issue Nov 23, 2015 · 14 comments
Labels
fs Issues and PRs related to the fs subsystem / file system. module Issues and PRs related to the module subsystem. windows Issues and PRs related to the Windows platform.

Comments

@miklen
Copy link

miklen commented Nov 23, 2015

In our Windows build environment we are opening a lot of files through the use of browserify and debowerify. Our build stopped working when we upgraded to the latest NodeJS, with an EMFILE error.

I reverted back to NodeJS 0.12.7 and the build works again. I started testing the different versions and found that the error started happning on iojs v.1.2.0 (iojs 1.1.0 runs our build with no errors).

The error I'm getting is this:

{ [Error: EMFILE: too many open files, open 'c:\Projekter\GitProjects\POS\bower_components\jqueryui\.bower.json']
  errno: -4066,
  code: 'EMFILE',
  syscall: 'open',
  path: 'c:\\Projekter\\GitProjects\\POS\\bower_components\\jquery-ui\\.bower.js
on',
  details: 'EMFILE: too many open files, open \'c:\\Projekter\\GitProjects\\POS\\bower_components\\jquery-ui\\.bower.json\'' }

In the versions of iojs and nodejs which are throwing the errors, I found that limiting the number of require calls in our app made it work again. Leaving out parts of the app is not really an option, so I hope someone can shed some light on this for me here.

@JungMinu
Copy link
Member

would you describe in detail?

@miklen
Copy link
Author

miklen commented Nov 23, 2015

Sorry, I misclicked enter. I'm editing the OP right now.

@miklen miklen changed the title EMFILE error appear ein iojs v1.2.0 EMFILE error appears in iojs v1.2.0 on Windows Nov 23, 2015
@silverwind
Copy link
Contributor

v1.1.0...v1.2.0, maybe e653080.

@miklen can you try to git bisect this?

@silverwind silverwind added fs Issues and PRs related to the fs subsystem / file system. module Issues and PRs related to the module subsystem. labels Nov 23, 2015
@miklen
Copy link
Author

miklen commented Nov 23, 2015

@silverwind I've never tried it before, but I'll see if I can figure it out. I'll get back when I know which commit it is... or to declare failure :)

@cjihrig
Copy link
Contributor

cjihrig commented Nov 23, 2015

@miklen are you seeing this error on a more recent version of Node (4.2.x and up)?

@miklen
Copy link
Author

miklen commented Nov 23, 2015

@cjihrig yes. I've tried it with both 4.2.2 LTS and 5.1.0 stable, and both versions produce the error. The most recent version I've found to not produce the error is iojs 1.1.0. I tried all minor versions down from the last iojs version and down and all above 1.1.0 produces the error.

@miklen
Copy link
Author

miklen commented Nov 23, 2015

It looks like I'm not able to build node from the source code. When I try I get this:

c:\code\node>vcbuild nosign
Looking for Visual Studio 2015
Found Visual Studio 2015
ctrpp not found in WinSDK path--using pre-gen files from tools/msvs/genfiles.
creating  icu_config.gypi
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'asan': 0,
                 'host_arch': 'x64',
                 'icu_small': 'false',
                 'node_byteorder': 'little',
                 'node_install_npm': 'true',
                 'node_prefix': '/usr/local',
                 'node_release_urlbase': '',
                 'node_shared_http_parser': 'false',
                 'node_shared_libuv': 'false',
                 'node_shared_openssl': 'false',
                 'node_shared_zlib': 'false',
                 'node_tag': '',
                 'node_use_dtrace': 'false',
                 'node_use_etw': 'true',
                 'node_use_lttng': 'false',
                 'node_use_openssl': 'true',
                 'node_use_perfctr': 'true',
                 'openssl_fips': '',
                 'openssl_no_asm': 0,
                 'python': 'c:\\Program Files\\Python27\\python.exe',
                 'target_arch': 'ia32',
                 'v8_enable_gdbjit': 0,
                 'v8_enable_i18n_support': 0,
                 'v8_no_strict_aliasing': 1,
                 'v8_optimized_debug': 0,
                 'v8_random_seed': 0,
                 'v8_use_snapshot': 'true',
                 'want_separate_host_toolset': 1}}
creating  config.gypi
creating  config.mk
Project files generated.
  ares__read_line.c
  ares__timeval.c
  ares_free_string.c
  ares_getenv.c
  ares_init.c
  ares_library_init.c
  ares_llist.c
  ares_mkquery.c
  ares_nowarn.c
  ares_options.c
  ares_parse_a_reply.c
  ares_parse_aaaa_reply.c
  ares_parse_mx_reply.c
  ares_parse_naptr_reply.c
  node_js2c
  'c:\Program' is not recognized as an internal or external command,
  operable program or batch file.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targ
ets(171,5): error MSB6006: "cmd.exe" exited with code 1. [c:\code\node\node_js2
c.vcxproj]
  ares_parse_ns_reply.c
  Assembling asm\x86-win32-masm\aes\aes-586.asm to Release\obj\openssl\aes-586.
  obj.
  ares_parse_ptr_reply.c
  ares_parse_soa_reply.c
  fs-poll.c
  inet.c
  threadpool.c
  gtest-death-test.cc
  ares_parse_srv_reply.c
  gtest-filepath.cc
  uv-common.c
  gtest-port.cc
  version.c
  ares_parse_txt_reply.c
  gtest-printers.cc
  async.c
  http_parser.c
[... continues with a lot of building...]

When it was done it did not work however. When I try to verify the build I get this:

c:\code\node> node -e "console.log('Hello from node.js ' + process.version)"
'node' is not recognized as an internal or external command,
operable program or batch file.

Any ideas how to get it to build so I can test the commits?

@silverwind
Copy link
Contributor

According to http://stackoverflow.com/questions/17300638/building-node-js-v0-10-12-on-windows, reinstalling Python in a path without spaces might help, e.g. C:\python27.

@silverwind silverwind added the windows Issues and PRs related to the Windows platform. label Nov 23, 2015
@miklen
Copy link
Author

miklen commented Nov 23, 2015

Thanks - I got it working. And to my surprise, it looks like the issue has been resolved in the current HEAD commit on the master branch. I installed 5.1.0 again to recheck that I get the error in that version, and I do.

I will try and investigate which commit since 5.1.0 and the HEAD on master fixed the issue.

@silverwind
Copy link
Contributor

It might be interesting to inspect open file handles when you hit EMFILE. Not sure what the best tooling for that is on Windows, but you could give Handle a try, or inspect the process in Process Explorer.

@miklen
Copy link
Author

miklen commented Nov 24, 2015

I tried bisecting the commits between HEAD and 5.1.0 and found that they all works. I then tried checking out the v5.1.0 commit (which fails for me when I install it from nodejs.org), and that commit works as well. So apparently I am unable to reproduce the error when I compile the code myself.

The error is not isolated to my machine though. Everyone in my team has the issue when using the installer versions from the website.

I'll see if I can inspect the file handles when I experience the error.

@Fishrock123
Copy link
Contributor

@miklen Any luck?

Could this be due to MSVS build differences? DO binaries you build work on the other machines at your work?

@miklen
Copy link
Author

miklen commented Dec 8, 2015

@Fishrock123 unfortunately not yet. I haven't had time to do more testing yet.

We're all running Visual Studio 2015 on Windows 10 and Window 7. I can try my binaries on one of the other machines. Unfortunately I don't have a machine available without VS2015.

@bnoordhuis
Copy link
Member

Closing due to inactivity.

This was referenced Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. module Issues and PRs related to the module subsystem. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

6 participants