Description
Hi
I updated my api-platform project from v3.1.14 to v3.2.10 with the new FrankenPHP instead of Caddy and I'm experiencing some stability problems after deploying it in production.
I'm not sure 100% that it's all frankenphp related as it's also a new PHP and Symfony version but I suspect it is, maybe caching OPcache related?
My main problem is that I use symfony/ldap to authenticate. It works ok but so far ~every 1 to 2 days it will lock up and throw:
"message": "Uncaught PHP Exception Symfony\\Component\\Ldap\\Exception\\ConnectionException: \"Can't contact LDAP server\" at Connection.php line 86",
on every request until I recreate the PHP container.
I know it's not the ldap server as it worked before, the port is accessible from inside the container and it goes back to working once I recreate the container.
I would appreciate it if you could point me in some direction on how to troubleshoot this more since I wasn't able to reproduce the problem in my test environment.
While trying to investigate I encounter 2 other things regarding OPcache and FrankenPHP.
First, looking online on how to clear the OPcache in a container the only thing I found that worked (without recreating the container) was running kill -USR2 1
. On the old Caddy container it worked nicely. The edits in the php files were loaded and the container stayed up.
The Caddy service for example:
/srv # ps aux -o user,group,comm,pid,ppid,pgid,etime,nice,rgroup,ruser,time,tty,vsz,sid,stat,rss,args
USER GROUP COMMAND PID PPID PGID ELAPSED NI RGROUP RUSER TIME TT VSZ SID STAT RSS COMMAND
root root caddy 1 0 1 24:43 0 root root 0:05 ? 1.2g 1 S 56m caddy run --config /etc/caddy/Caddyfile --watch
Doing the same in the new PHP container, the frankenphp service doesn't reload the cache ignoring the signal, if I try a more aggressive kill 1
the container fails and recreated (as expected).
The FrankenPHP service for example:
/srv # ps aux -o user,group,comm,pid,ppid,pgid,etime,nice,rgroup,ruser,time,tty,vsz,sid,stat,rss,args
USER GROUP COMMAND PID PPID PGID ELAPSED NI RGROUP RUSER TIME TT VSZ SID STAT RSS COMMAND
root root frankenphp 1 0 1 4:40 0 root root 0:03 136,0 1.7g 1 S 285m frankenphp run --config /etc/caddy/Caddyfile
Can I clear the OPcache in FrankenPHP like in Caddy?
Second, in the old version, modifying the ".env" or ".env.local.php" the changes are immediately picked up (I assume there is somewhere an exception for the env files for the caching?), but in the new version, the changes are not reflected.
The more bizarre part is that if I send some requests (like holding F5 for 2 seconds) the changes to the env files are partially loaded. like the system now has something like multiple versions cached so if you refresh it will loop on some pattern like updated, updated, updated, old config, old config. It loops like that on every request until recreating the container (or probably restarting FrankenPHP/OPcache but I don't know how to test it).
Help will be appreciated as I hope to avoid migrating everything back to the old version.
Thank you.