0

While using AMPHP libraries for thread working tasks, I suddenly got the Warning and Error:

PHP Warning:  include(/.../vendor/amphp/process/lib/ProcessException.php): failed to open stream: Too many open files in /.../vendor/composer/ClassLoader.php on line 445
PHP Fatal error:  Uncaught Error: Class 'Amp\Failure' not found

This was previously working fine, and started to get the issue recently.

Using:

  • PHP 7.4.21 (cli)
  • macOS
  • "amphp/parallel-functions": "^1.0"
ecairol
  • 6,233
  • 1
  • 27
  • 26
  • Does this answer your question? [Fatal Error - Too many open files](https://stackoverflow.com/questions/14748499/fatal-error-too-many-open-files) – Nico Haase Sep 21 '21 at 05:54
  • @NicoHaase thanks for the suggestion. Thinking this from a person having this issue in the future with PHP thread worker: which question are they most likely to find: this one, or a generic one related to PHPUnit Tests and multiple solutions? On the other Question, one of the proposals is increasing `ulimit` indeed, but I took the time to write this question and answer for people with the same issue, specifically with PHP thread workers – ecairol Sep 23 '21 at 16:41

1 Answers1

0

According to a thread on AMPHP GitHub issue page: https://github.com/amphp/parallel-functions/issues/22

On macOS, the ulimit is by default 1024.

In my case, upgrading that to ulimit -n 4096 as suggested, worked fine.

According to IBM docs: "ulimit sets or displays the resource limits on processes created by the user." More info.

ecairol
  • 6,233
  • 1
  • 27
  • 26