question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: Error: EMFILE: too many open files

See original GitHub issue

At first, thanks for this reader.

I want to read over 80k mp3 tags for my Software. But after 7k the performance break down an finished with:

Error: EMFILE: too many open files....

Can someone help me to queue the async calls, with async or something like that: https://caolan.github.io/async/docs.html#queue

Thanks

me code now is:

walker = walk.walk("/Volumes/..");
var mm = require('music-metadata');
const util = require('util');
walker.on("file", function (root, fileStats, next) {
 //todo, noch die anderen file extension freigeben
 if (path.extname(fileStats.name) === ".mp3") {
   mm.parseFile(path.join(root, fileStats.name)).then(function (metadata) {
     console.log(util.inspect(metadata, { showHidden: false, depth: null }));
   }).catch(function (err) {
     console.error(err.message);
   });
 }
 next();
});

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Borewitcommented, Aug 20, 2017

Following code parsed 48k files without any issue:

const walk = require('walk')

var mm = require('music-metadata');
const util = require('util');
const path = require('path');

const walker = walk.walk("M:\\");

var filesParsed = 0;

walker.on("file", function (root, fileStats, next) {
  switch(path.extname(fileStats.name)) {
    case ".mp3":
    case ".flac":
      // Queue (asynchronous call) parsing of metadata
      mm.parseFile(path.join(root, fileStats.name)).then(function (metadata) {
        // console.log(util.inspect(metadata, { showHidden: false, depth: null }));
        console.log('Parsed %s files, last file: %s',  ++filesParsed, fileStats.name);
        next(); // asynchronous call completed, 'release' next
      }).catch(function (err) {
        console.error(err.message);
        next();
      });
      break;
    
    default:
      next(); // Go to next file, no asynchronous call 'queued'
  }
});
0reactions
Newancommented, Aug 21, 2017

Version 0.8.0 works even better. if the mp3 collection is free from scrap all works fine. If not, you have an problem not the lib…

Thanks for the great support!

Read more comments on GitHub >

github_iconTop Results From Across the Web

node and Error: EMFILE, too many open files - Stack Overflow
After a number of searches I found a work around for the "too many open files" problem: var requestBatches = {}; function batchingReadFile(filename,...
Read more >
EMFILE: too many open files, watch · Issue #923 - GitHub
i'm facing below issue while generating archive in xcode node:events:371 throw er; // Unhandled 'error' event ^ Error: EMFILE: too many open ......
Read more >
How to fix the: "EMFILE: too many open files, watch" error in ...
A quick guide to how I solved a confusing React Native error. ... How to fix the: "EMFILE: too many open files, watch"...
Read more >
KB20737: “System Error (EMFILE): Too many open files” error ...
System Error (EMFILE): Too many open files” error appears when running reports in MicroStrategy Web 9.x.
Read more >
"EMFILE: too many open files error" while CI/CD deploy
I can upload my code from my local with sls deploy. It works well. No problem. So i think there is no problem...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found