kaangiray26 / forte

Self-hosted, music streaming platform
https://forte.buzl.uk/
GNU General Public License v3.0
341 stars 13 forks source link

Too many open files to watch folder #112

Open SteveDinn opened 1 year ago

SteveDinn commented 1 year ago

Just tried to bring up a forte server with the docker-compose.yml from the repo. Apparently, I have too many open files on my system to watch changes in a folder. Would it be possible to revert to periodic (or manually-triggered) scans if this is the case?

Logs from kaangiray26/forte:2.7 container:

app_1  | ..: Starting forte :..
app_1  | ..: Open the web player at https://forte.buzl.uk/ :..
app_1  | ..: Server:    http://0.0.0.0:3000/ :..
app_1  | node:internal/errors:490
app_1  |     ErrorCaptureStackTrace(err);
app_1  |     ^
app_1  |
app_1  | Error: EMFILE: too many open files, watch '/library'
app_1  |     at FSWatcher.<computed> (node:internal/fs/watchers:247:19)
app_1  |     at Object.watch (node:fs:2332:36)
app_1  |     at createFsWatchInstance (/node_modules/chokidar/lib/nodefs-handler.js:119:15)
app_1  |     at setFsWatchListener (/node_modules/chokidar/lib/nodefs-handler.js:166:15)
app_1  |     at NodeFsHandler._watchWithNodeFs (/node_modules/chokidar/lib/nodefs-handler.js:331:14)
app_1  |     at NodeFsHandler._handleDir (/node_modules/chokidar/lib/nodefs-handler.js:567:19)
app_1  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
app_1  |     at async NodeFsHandler._addToNodeFs (/node_modules/chokidar/lib/nodefs-handler.js:617:16)
app_1  |     at async /node_modules/chokidar/index.js:451:21
app_1  |     at async Promise.all (index 0)
app_1  | Emitted 'error' event on FSWatcher instance at:
app_1  |     at FSWatcher._handleError (/node_modules/chokidar/index.js:647:10)
app_1  |     at NodeFsHandler._addToNodeFs (/node_modules/chokidar/lib/nodefs-handler.js:645:18)
app_1  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
app_1  |     at async /node_modules/chokidar/index.js:451:21
app_1  |     at async Promise.all (index 0) {
app_1  |   errno: -24,
app_1  |   syscall: 'watch',
app_1  |   code: 'EMFILE',
app_1  |   path: '/library',
app_1  |   filename: '/library'
app_1  | }
app_1  |
app_1  | Node.js v19.7.0
forte_app_1 exited with code 1
kaangiray26 commented 1 year ago

For future record, how large is your library? It's the first time I've seen this issue, I'll take a look into this. Thanks.

SteveDinn commented 1 year ago

I don't think it has anything to do with the size of my library. My system as a whole just has to many concurrently-open files. I have about 30,000 files in my library though, a mix of flac and mp3.

SteveDinn commented 1 year ago

I also get this message when running tail -f on a file on my system:

tail: inotify cannot be used, reverting to polling: Too many open files

So I think the number of files in my library is not the issue.

SteveDinn commented 1 year ago

Hrm...I tried everything in this post, but it's still not working for me. Maybe your investigation will yield better results :)

https://askubuntu.com/questions/299689/tail-inotify-cannot-be-used-reverting-to-polling-too-many-open-files

kaangiray26 commented 1 year ago

Have you tried increasing max user watches count in your file system?

SteveDinn commented 1 year ago

Yeah, I have plenty of available files according to the commands in that article.