-
Notifications
You must be signed in to change notification settings - Fork 426
Description
What happened?
Apparently FrankenPHP is launching two Goroutines, where one has the environment variables and the other does not, generating this error:
{"level":"info","ts":1723499343.966919,"msg":"[error] Warning: Undefined array key \"QNT_PUBLICACOES_POR_PAGINA\"","syslog_level":"notice"}
{"level":"info","ts":1723499344.042241,"msg":"[error] Warning: Undefined array key \"APP_ENV\"","syslog_level":"notice"}
{"level":"info","ts":1723499344.2245831,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"172.23.0.4","remote_port":"47056","client_ip":"172.23.0.4","proto":"HTTP/1.1","method":"GET","host":"XXXXX","uri":"/publicacoes?ultimoVisto=384","headers":{"Upgrade-Insecure-Requests":["1"],"X-Forwarded-Server":["5b8a887a3712"],"Accept-Encoding":["gzip, br"],"Cf-Ray":["8b23ac518da602eb-GRU"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"X-Forwarded-Host":["XXXXX"],"X-Forwarded-Proto":["https"],"Cf-Ipcountry":["BR"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-User":["?1"],"Cookie":["REDACTED"],"Priority":["u=0, i"],"X-Forwarded-For":["172.71.10.159"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8"],"Cf-Connecting-Ip":["XXXXX"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-Site":["none"],"X-Forwarded-Port":["443"],"X-Real-Ip":["XXXXX"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0"],"Accept-Language":["pt-BR"],"Cdn-Loop":["cloudflare"]}},"bytes_read":0,"user_id":"","duration":0.382732846,"size":31264,"status":200,"resp_headers":{"Permissions-Policy":["browsing-topics=()"],"Server":["Caddy"],"Cache-Control":["no-cache, private"],"Date":["Mon, 12 Aug 2024 21:49:04 GMT"],"Content-Type":["application/json"],"Content-Encoding":["br"],"Vary":["Accept-Encoding"]}}
When it is executed by the routine that has the environment variables, the log is just this:
{"level":"info","ts":1723499345.9641595,"logger":"http.log.access.log0","msg":"handled request","request":{"remote_ip":"172.23.0.4","remote_port":"47056","client_ip":"172.23.0.4","proto":"HTTP/1.1","method":"GET","host":"XXXXX","uri":"/publicacoes?ultimoVisto=384","headers":{"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0"],"Cdn-Loop":["cloudflare"],"X-Forwarded-Port":["443"],"X-Forwarded-Server":["5b8a887a3712"],"X-Forwarded-For":["172.71.10.159"],"X-Forwarded-Host":["XXXXX"],"X-Forwarded-Proto":["https"],"X-Real-Ip":["XXXXX"],"Accept-Encoding":["gzip, br"],"Accept-Language":["pt-BR"],"Cf-Connecting-Ip":["XXXXX"],"Cf-Ray":["8b23ac6009b402eb-GRU"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8"],"Cf-Ipcountry":["BR"],"Sec-Fetch-Site":["none"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-User":["?1"],"Upgrade-Insecure-Requests":["1"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Cookie":["REDACTED"],"Priority":["u=0, i"],"Sec-Fetch-Dest":["document"]}},"bytes_read":0,"user_id":"","duration":0.021481712,"size":31266,"status":200,"resp_headers":{"Date":["Mon, 12 Aug 2024 21:49:05 GMT"],"Content-Type":["application/json"],"Content-Encoding":["br"],"Vary":["Accept-Encoding"],"Permissions-Policy":["browsing-topics=()"],"Server":["Caddy"],"Cache-Control":["no-cache, private"]}}
And the system works normally.
If you keep refreshing the page (F5), the result is like this:
1st request = error
2nd request = success
3rd request = error
4th request = success
5th request = error
6th request = success
In other words, it alternates between the application that has all the environment variables and the other that does not.
In my infrastructure there is only one docker container running my application, so the requests always fall into the same container, including the logs reported here are from the same container.
The problem occurs both on my development machine (x86_64) and on my server (aarch64) in Oracle Cloud.
I use Cloudflare, which is responsible for generating the SSL, but it requires that my server also has a valid SSL, which is a reverse proxy using Traefik, which generates the SSL with Let's Encrypt and within the container the SSL is disabled SERVER_NAME=my-domain:80. But in the development environment, access is made directly to the localhost:8008 container.
My configuration is the same as this repository dunglas/symfony-docker, i only disabled Mercure for Caddy.
I'm using Symfony 7
Build Type
Docker (Debian Bookworm)
Worker Mode
Yes
Operating System
GNU/Linux
CPU Architecture
x86_64
PHP configuration
https://github.com/dunglas/symfony-docker/tree/mainRelevant log output
No response