1

I've created php-cli.ini, added pthread extension there and set memory limit to 3 gb. But when I'am trying to launch thread script I got this:

PHP Fatal error:  Uncaught RuntimeException: cannot start my_thread, out of resources in 
C:\xampp\htdocs\app90\start_threads.php:160

Stack trace:
#0 C:\xampp\htdocs\app90\start_threads.php(160): Thread->start()
#1 {main}
  thrown in C:\xampp\htdocs\app90\start_threads.php on line 160

Fatal error: Uncaught RuntimeException: cannot start my_thread, out of resources
 in C:\xampp\htdocs\app90\start_threads.php:160

help required thanks in advance.

1 Answers1

1

Essentially, this is caused by pthread_create returning EAGAIN: It means that the system lacks resources to create another thread, or that the system imposed limit on the maximum number of threads (in a process, or system wide) has been reached.

This can be caused by two things, the purposeful use of more threads than a process can handle simultaneously as a result of the way some software is designed, or more perniciously, as a result of less than graceful joining of threads.

If you only seem to hit such errors sometimes, it would suggest the latter is going on; Be sure to cleanup (explicitly join) threads you are done with to make behaviour predictable.

Arsalan Akhtar
  • 395
  • 2
  • 15
  • yes i hope this will help you https://stackoverflow.com/questions/35113527/curl-pthreads-issue-out-of-resources-on-php-7x86 – Arsalan Akhtar Jun 07 '18 at 11:53