calzoneman / sync

Node.JS Server and JavaScript/HTML Client for synchronizing online media
Other
1.46k stars 235 forks source link

ffprobe spawn ENOMEM issue #843

Open calzoneman opened 4 years ago

calzoneman commented 4 years ago

Has happened a few times now.

node's spawn internally uses fork() which duplicates the memory of the parent process. On systems where the node heap is larger than 50% of the host memory, this results in spawn ENOMEM errors when spawning ffprobe.

Ideally the ffprobe check should be split out into a separate process from the beginning to avoid needing to fork the main process for each lookup. Eventually I want to move all the media lookup logic into a separate daemon but for now forking a dummy process at startup and using that to fork future ffprobes might work.