could not send SSL negotiation packet: Resource temporarily unavailable

Is anyone else running into this? My (Laravel) app suddenly stopped working. It gives 500 errors because of the error as mentioned in the title:

2024-06-28T14:28:39Z app[e286011c9d9718] ams [info]{"message":"SQLSTATE[08006] [7] could not send SSL negotiation packet: Resource temporarily unavailable (SQL: select * from \"sessions\" where \"id\" = 8dLPlpfUE0pI2ZduBEXSVTdLnFC2JPIqcI037mil limit 1)","context":{"exception":{"class":"Illuminate\\Database\\QueryException","message":"SQLSTATE[08006] [7] could not send SSL negotiation packet: Resource temporarily unavailable (SQL: select * from \"sessions\" where \"id\" = 8dLPlpfUE0pI2ZduBEXSVTdLnFC2JPIqcI037mil limit 1)","code":7,"file":"/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760","previous":{"class":"PDOException","message":"SQLSTATE[08006] [7] could not send SSL negotiation packet: Resource temporarily unavailable","code":7,"file":"/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70"}}},"level":400,"level_name":"ERROR","channel":"production","datetime":"2024-06-28T16:28:39.590724+02:00","extra":{}}

1 Like

I am also having this issue with my Laravel 11 application. It is quite annoying because I have been on it for a while since yesterday (06/27/2024 around 8 PM PST) rolling back my releases, but nothing seems to work. I even checked if there is something wrong with my Supabase database, but my local instance is able to connect to it perfectly fine with a forced SSL connection.

I don’t know if this is related to the issue, but my deploying process has been pretty finicky with this error: Failed to fetch an image or build from source: failed to list volumes: Get "https://api.machines.dev/v1/apps/fly-builder-misty-cloud-1280/volumes": remote error: tls: handshake failure
I would have to just keep try running the deploy script until it would go through with the build process. It may be a coincidence, but I only started getting this error when my application stopped working. I am assuming these errors are on Fly.io’s end because I am out of ideas on what to try and also you are also having this issue.

1 Like

I am also having this same issue but only noticing it now, I am using a database on railway. Just trying to login there next to check but it’s basically causing issues all over the place on my website and dashboard apps. I noticed the same issue over the past few days but it was during builds and I really did not care about the change enough to look at a fix so I just ignored the failed builds. It was only yesterday that the build actually succeeded for the laravel application and just now, I am seeing the same error but on my built application on fly.

@discoverlance @ryvami Check this github thread: Possible bug with PHP PDO and with PostgreSQL · Issue #14665 · php/php-src · GitHub

I solved it after removing php8.2-swoole in the Dockerfile. It’s an issue with PHP 8.2.20 in combination with the swoole extension

1 Like

Since I am using fly’s original Dockerfile for laravel deployment and it has no direct installation of swoole in it so I am not sure how to remove that? Are you using a custom docker file? The Dockerfile has no installation line for swoole only the config file or is that what does the trick? Also, I am not using octane in my application

# syntax = docker/dockerfile:experimental

# Default to PHP 8.2, but we attempt to match
# the PHP version from the user (wherever `flyctl launch` is run)
# Valid version values are PHP 7.4+
ARG PHP_VERSION=8.2
ARG NODE_VERSION=16
ARG POSTGRES_VERSION=13
FROM fideloper/fly-laravel:${PHP_VERSION} as base

RUN curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null

RUN echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list

RUN apt-get update

RUN apt-get install -y postgresql-client-13

# PHP_VERSION needs to be repeated here
# See https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG PHP_VERSION

LABEL fly_launch_runtime="laravel"

# copy application code, skipping files based on .dockerignore
COPY . /var/www/html

RUN composer install --optimize-autoloader --no-dev \
    && mkdir -p storage/logs \
    && php artisan optimize:clear \
    && chown -R www-data:www-data /var/www/html \
    && sed -i 's/protected \$proxies/protected \$proxies = "*"/g' app/Http/Middleware/TrustProxies.php \
    && echo "MAILTO=\"\"\n* * * * * www-data /usr/bin/php /var/www/html/artisan schedule:run" > /etc/cron.d/laravel \
    && cp .fly/entrypoint.sh /entrypoint \
    && chmod +x /entrypoint

# If we're using Octane...
RUN if grep -Fq "laravel/octane" /var/www/html/composer.json; then \
    rm -rf /etc/supervisor/conf.d/fpm.conf; \
    if grep -Fq "spiral/roadrunner" /var/www/html/composer.json; then \
    mv /etc/supervisor/octane-rr.conf /etc/supervisor/conf.d/octane-rr.conf; \
    if [ -f ./vendor/bin/rr ]; then ./vendor/bin/rr get-binary; fi; \
    rm -f .rr.yaml; \
    else \
    mv .fly/octane-swoole /etc/services.d/octane; \
    mv /etc/supervisor/octane-swoole.conf /etc/supervisor/conf.d/octane-swoole.conf; \
    fi; \
    rm /etc/nginx/sites-enabled/default; \
    ln -sf /etc/nginx/sites-available/default-octane /etc/nginx/sites-enabled/default; \
    fi

# Multi-stage build: Build static assets
# This allows us to not include Node within the final container
FROM node:${NODE_VERSION} as node_modules_go_brrr

RUN mkdir /app

RUN mkdir -p  /app
WORKDIR /app
COPY . .
COPY --from=base /var/www/html/vendor /app/vendor

# Use yarn or npm depending on what type of
# lock file we might find. Defaults to
# NPM if no lock file is found.
# Note: We run "production" for Mix and "build" for Vite
RUN if [ -f "vite.config.js" ]; then \
    ASSET_CMD="build"; \
    else \
    ASSET_CMD="production"; \
    fi; \
    if [ -f "yarn.lock" ]; then \
    yarn install --frozen-lockfile; \
    yarn $ASSET_CMD; \
    elif [ -f "package-lock.json" ]; then \
    npm ci --no-audit; \
    npm run $ASSET_CMD; \
    else \
    npm install; \
    npm run $ASSET_CMD; \
    fi;

# From our base container created above, we
# create our final image, adding in static
# assets that we generated above
FROM base

# Packages like Laravel Nova may have added assets to the public directory
# or maybe some custom assets were added manually! Either way, we merge
# in the assets we generated above rather than overwrite them
COPY --from=node_modules_go_brrr /app/public /var/www/html/public-npm
RUN rsync -ar /var/www/html/public-npm/ /var/www/html/public/ \
    && rm -rf /var/www/html/public-npm \
    && chown -R www-data:www-data /var/www/html/public

EXPOSE 8080

ENTRYPOINT ["/entrypoint"]


I just did it like this:

I am also not using octane, but the extension is installed either way :slight_smile:

2 Likes

This worked for me! Thanks a lot

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.