Borewit / music-metadata

Stream and file based music metadata parser for node. Supporting a wide range of audio and tag formats.
MIT License
888 stars 90 forks source link

"Error: EPERM: operation not permitted, open" when running "parseFile" #1153

Closed jlcampbell1991 closed 2 years ago

jlcampbell1991 commented 2 years ago

I'm using parseFile to read metadata from a Node app on my raspi machine reading from a mounted directory and receiving errors like:

  [Error: EPERM: operation not permitted, open '/mnt/nextcloud/iTunes Media/Music/Jeremy Larson/Salvation Club/05 Self Esteem.m4a'] {
  errno: -1,
  code: 'EPERM',
  syscall: 'open',
  path: '/mnt/nextcloud/iTunes Media/Music/Jeremy Larson/Salvation Club/05 Self Esteem.m4a'
}

Getting this error whether i run as root or my primary user

Borewit commented 2 years ago

I don't think this error is related to music-metadata.

Try another file operation with path, and see if that works. Otherwise move the file to a different location (e.g. /tmp and see if it works from there.

jlcampbell1991 commented 2 years ago

Thanks for responding so quickly.

For posterity, I'll describe my solution to the problem.

I'm trying to read through my entire music library, 6k+ songs, and create a DB in a nodejs app. Originally, I ran parseFile for each song. When developing locally on macOS, I had no trouble running the command 6k+ times, but on my production linux environment, I ran into the EPERM error if I ran more than 500 parseFiles at a time. In prototyping the feature for this app, I had read somewhere that there are limits to how many processes a user can run (vague, I know). I changed the logic in the app to split the parseFiles into chunks of 500 and send to the DB, instead of getting all 6k and sending to the DB.

This seems to be working, even though it's slower.

Borewit commented 2 years ago

For posterity, I'll describe my solution to the problem.

That gives a lot more context.

I ran more than 500 parseFiles at a time

Please ensure you run parseFile in serial rather then parallel, which I think you already doing. So make sure you, only you only parsing the following song after the promise of parseFile has been resolved. You could consider to also wait for the track data to be written to the database, just to ensure those requests are not piling up.

I have designed music-metadata to iterate over (large) music libraries, so it's a common use case.