How to fix pool valet : child exited leading to error 502?

292 Views Asked by At

I cannot login to my locale Laravel API from Nuxt frontend on macos, I'm getting 502 error.

Below are my logs for nginx and php-fpm:

$ tail .config/valet/Log/nginx-error.log
upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: , request: "POST /oauth/token HTTP/1.1", upstream: "fastcgi://unix:/Users/me/.config/valet/valet.sock:", host: "api.test"

$ tail -f /usr/local/var/log/php-fpm.log                                                                                                   [11-Oct-2023 11:53:19] WARNING: [pool valet] child 427 exited on signal 9 (SIGKILL) after 2515.992482 seconds from start
[11-Oct-2023 11:53:19] NOTICE: [pool valet] child 8266 started
[11-Oct-2023 11:55:05] WARNING: [pool valet] child 426 exited on signal 6 (SIGABRT) after 2622.943313 seconds from start
[11-Oct-2023 11:55:05] NOTICE: [pool valet] child 8325 started

I have removed and reinstalled valet, php, nginx and dnsmasq with their configuration files many times. I have also updated composer global packages (for valet) and brew (for php, nginx and dnsmasq), I cleared Laravel cache (php artisan cache:clear). Valet status is Healthy... none of my actions fixed this 502 issue.

Where could it come from and how to fix this issue?

1

There are 1 best solutions below

0
DevonDahon On

I finally fixed my issue thanks to this post.

Find homebrew.mxcl.php.plist in /usr/local/ (mac intel) or /etc/homebrew (mac silicon), in folder Cellar/php/8.2.8 (assuming you're on PHP 8.2.8).

After this:

<key>RunAtLoad</key>
<true/>

Add this:

<key>EnvironmentVariables</key>
<dict>
    <key>OBJC_DISABLE_INITIALIZE_FORK_SAFETY</key>
    <string>YES</string>
</dict>

Then, execute valet restart.

See the original post for further details and cleanup if needed.