npkill icon indicating copy to clipboard operation
npkill copied to clipboard

Got "spawn cut EMFILE" on Ubuntu 18

Open lolobosse opened this issue 5 years ago • 6 comments

Describe the bug I tried npkill and I got following error after few seconds To Reproduce Steps to reproduce the behavior: $ npkill

  • OS: Ubuntu 18 LTS
  • Version 0.4.3

Additional context ERROR:

      throw er; // Unhandled 'error' event
      ^

Error: spawn cut EMFILE
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)

lolobosse avatar Aug 22 '19 14:08 lolobosse

I got the same error on osx 10.14.4 - (node v10.16.0)

hhuseyinpay avatar Aug 22 '19 17:08 hhuseyinpay

Thank you very much for opening this report! I recently noticed that sometimes (personally, infrequently), that error is thrown.

Npkill on unix systems invokes 2 commands to determine the size for each of the results found. The cause seems to be due to an excess of simultaneous reading of files in that process.

I don't have much free time for now to be able to fix this, but here are two temporary solutions:

  • Start the analysis in a directory with fewer files.
  • By executing ulimit -n 10480 the error should stop appearing (ATTENTION I have not tried it or know what adverse effects it could have)

Similar problem

zaldih avatar Aug 22 '19 22:08 zaldih

We have released version 0.5.0 :confetti_ball: We have controlled many types of exceptions, including the mentioned one.

Could you tell me if you can already use npkill?

I imagine there will be directories that show their space as "--"

zaldih avatar Aug 25 '19 14:08 zaldih

I guess the search cannot be completed. It stopped the search but search never completed successfully. Screen Shot 2019-08-25 at 19 51 37

hhuseyinpay avatar Aug 25 '19 16:08 hhuseyinpay

ulimit increases the number of open file handles you can have at one time. On OS X and certain Linux distros it is set to a lower value. If problems persist, try gradually increasing the number, or consider what other I/O intensive activities you may have going on.

ssimontis avatar Aug 27 '19 22:08 ssimontis

@hhuseyinpay thanks for the reply! Even in that state, can you use it normally or suffer from some kind of malfunction?

In any case, we will investigate further and correct it soon.

zaldih avatar Aug 27 '19 23:08 zaldih

In this time the related methods have undergone many changes, so it should not be a problem today. If it continues to be a problem, do not hesitate to reopen.

zaldih avatar Oct 10 '22 17:10 zaldih