Connection Error - Help Required

Your software
My Mautic version is: 4.4.1
My PHP version is: 8.0
My Database type and version is: Ver 15.1 Distrib 10.6.7-MariaDB

Your problem
My problem is:
We are seeing a number of connection errors in the log on connection - it is sporadic, but would like to see if there is a way to pinpoint what they are and if there is a way to correct the situation.
The site is a high traffic site.

These errors are showing in the log:
mautic.error:2022/09/13 06:39:05 [crit] 139582#139582: *1202945 SSL_read() failed (SSL: error:0A000126:SSL routines::unexpected eof while reading) while processing HTTP/2 connection, client: 199.999.222.999, server: 0.0.0.0:443

Steps I have tried to fix the problem:
Nothing as of yet besides writing here :slight_smile:

Can you share more about the setup? Docker? VPS? LXC?

Hey Joey,

Yes,
Manual setup on Ubuntu 22.04 dedicated server, running php 8.0.
2 Intel vCPU
4GB Memory
1GB Swap enabled

openssl version -a

OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)
built on: Mon Jul  4 11:20:23 2022 UTC
platform: debian-amd64
options:  bn(64,64)
compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -Wa,--noexecstack -g -O2 -ffile-prefix-map=/build/openssl-Q8dQt3/openssl-3.0.2=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -DOPENSSL_TLS_SECURITY_LEVEL=2 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2
OPENSSLDIR: "/usr/lib/ssl"
ENGINESDIR: "/usr/lib/x86_64-linux-gnu/engines-3"
MODULESDIR: "/usr/lib/x86_64-linux-gnu/ossl-modules"
Seeding source: os-specific
CPUINFO: OPENSSL_ia32cap=0xfffa3223478bffff:0x818d19e07a9

lab_release -a

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.1 LTS
Release:	22.04
Codename:	jammy

nginx -V

nginx version: nginx/1.22.0
built by gcc 11.2.0 (Ubuntu 11.2.0-19ubuntu1) 
built with OpenSSL 3.0.2 15 Mar 2022
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-g -O2 -ffile-prefix-map=/data/builder/debuild/nginx-1.22.0/debian/debuild-base/nginx-1.22.0=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'

I am also seeing other errors that may be of concern:

mautic.error:2022/10/03 00:25:15 [error] 572614#572614: *666425 FastCGI sent in stderr: "PHP message: PHP Notice:  SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permissio
n denied (13) in /var/www/mautic/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php on line 106" while reading response header from upstream, client: 199.999.99.99, server: mymautic.com, request: "GET /mtc.js HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.0-fpm.sock:", host: "mymautic.com", referrer: "http://localhost:4200/"

and this:

mautic.error:2022/10/03 01:15:51 [error] 572613#572613: *670110 connect() to unix:/run/php/php8.0-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 199.999.99.99,
 server: mymautic.com, request: "GET /mtc.js HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.0-fpm.sock:", host: "mymautic.com", referrer: "https://mywebsite.com/"

and

mautic.error:2022/10/04 01:13:57 [error] 572614#572614: *788447 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 199.999.99.99, server: mymautic.com, request: "GET /mtc.js HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.0-fpm.sock", host: "mymauitc.com", referrer: "https://mywebsite.com/"

and

mautic.error:2022/10/04 01:15:42 [error] 572613#572613: *789210 connect() to unix:/run/php/php8.0-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 199.999.99.99,
 server: mymautic, request: "GET /?utm_source=mautic&utm_medium=email&utm_campaign=announcements&utm_content=web-welcome HTTP/2.0", upstream: "fastcgi://unix:/run/php/php8.0-fpm.sock:", host: "mymautic.com"

@joeyk - what do you think about this article: nginx - php-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream - Server Fault ?

clearly not a Mautic issue, I would think - rather openSSL, maybe in conjunction with nginx and/or HTTP/2…
See e.g. SSL_read() failed (SSL: error:0A000126:SSL routines::unexpected eof while reading) · Issue #18866 · openssl/openssl · GitHub where an nginx update helped.

Cheers
Ekke

Hi Ekke

Thanks for the reply. I already upgraded to latest nginx version a while ago.

Any thoughts on the error for

mautic.error:2022/10/03 00:25:15 [error] 572614#572614: *666425 FastCGI sent in stderr: “PHP message: PHP Notice: SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permissio n denied (13) in /var/www/mautic/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php on line 106” while reading response header from upstream, client: 199.999.99.99, server: mymautic.com, request: “GET /mtc.js HTTP/2.0”, upstream: “fastcgi://unix:/run/php/php8.0-fpm.sock:”, host: “mymautic.com”, referrer: “http://localhost:4200/

Looks like a read and write issue to the directory.

Check your php.ini and look for something like
session.save_path=

What it’s set to and check permission on that folder.

Not sure this is related to the original symptom. Quick Google search result recommends setting session.gc_probability = 0 :slight_smile:

Thanks @ekke , this is set to 0 already (I guess by default)…

@techbill in my php.ini this is actually commented out,

session.save_path = "/var/lib/php/sessions"

The files inside this directory all have permissions of www-data:www-data

May I ask, how did you solved the error? I have it also.
In my /etc/php/7.4/cli/php.ini are also:
session.gc_probability = 0 set
and
session.save_path = "/var/lib/php/sessions" commented out.
Did you uncommented the “path” line? Or simply ignored the error?

I do not think I ever solved this. I have noticed that Mautic does not work that nicely with ubuntu 22.04 and php8.0

We use 18.04 cause I saw issues even with 20.04.

1 Like