Dockerfile icon indicating copy to clipboard operation
Dockerfile copied to clipboard

Symfony application error : readv() failed (104: Connection reset by peer) while reading upstream

Open eotin opened this issue 7 months ago • 7 comments

I'm developing a Symfony application from base image webdevops/php-nginx-dev:8.3 and everything was going well until the end of last week when i've rebuild my containers.

Now we have our app not responding to any request, because of the following issue :

readv() failed (104: Connection reset by peer) while reading upstream, client: 172.24.0.1, server: _, request: "GET /webifa/afg/api/v4/app-config HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8081"

Our local configuration of our env dev did not change recently and i didn't understand why this issue is coming now.

These is our nginx config file the replace the one in the container :

location ~ "^\/webifa\/([a-z]{3})"
{
    set $COUNTRY $1;
    try_files $uri /index.php?$query_string;
}

location ~ \.php$
{
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass php;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME     $request_filename;
    fastcgi_param COUNTRY     $COUNTRY;
    fastcgi_read_timeout 600;
    fastcgi_buffer_size 32k;
    fastcgi_buffers 8 16k;
}

Here is my custom DockerFile :

FROM webdevops/php-nginx-dev:8.3 as base-image

WORKDIR /app

# nc is used in bin/docker-entrypoint.d/30-wait-for-database.sh
RUN apt-get update
RUN apt-get install netcat-traditional -y

RUN curl -sS https://get.symfony.com/cli/installer | bash
RUN mv /root/.symfony5/bin/symfony /usr/local/bin/symfony


FROM webdevops/php-nginx:8.3 as prod

WORKDIR /app

# nc is used in bin/docker-entrypoint.d/30-wait-for-database.sh
RUN apt-get update
RUN apt-get install netcat-traditional -y

RUN curl -sS https://get.symfony.com/cli/installer | bash
RUN mv /root/.symfony5/bin/symfony /usr/local/bin/symfony

COPY docker/webserver/nginx/10-php.conf /opt/docker/etc/nginx/vhost.common.d/10-php.conf

# See https://dockerfile.readthedocs.io/en/latest/content/DockerImages/dockerfiles/base.html#provisioning
COPY bin/docker-entrypoint.d/*  /opt/docker/provision/entrypoint.d/

COPY . .

ENV COMPOSER_ALLOW_SUPERUSER=1
RUN composer install

Thanks for your inputs

eotin avatar Jul 09 '24 11:07 eotin