music-metadata icon indicating copy to clipboard operation
music-metadata copied to clipboard

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

Open jlcampbell1991 opened this issue 2 years ago • 3 comments

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

jlcampbell1991 avatar Jun 19 '22 17:06 jlcampbell1991

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.

Borewit avatar Jun 19 '22 18:06 Borewit

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.

jlcampbell1991 avatar Jun 19 '22 20:06 jlcampbell1991

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.

Borewit avatar Jun 21 '22 06:06 Borewit