Skip to content

php-fpm SIGABRT when pg_connect() called with host parameter #13339

@ianthrive

Description

@ianthrive

Description

It does not happen if host=localhost is removed from the pg_connect() call.
Happens in 8.2 and 8.3. Does NOT happen in 8.1.
CLI is not affected.


The following code:

<?php
$c = pg_connect('host=localhost user=ian dbname=ipb');
print("done\n");

Resulted in this output:

[06-Feb-2024 11:04:49.029619] DEBUG: pid 85554, fpm_pctl_perform_idle_server_maintenance(), line 382: [pool www] currently 0 active children, 0 spare children
[06-Feb-2024 11:04:49.392539] DEBUG: pid 85554, fpm_children_make(), line 430: blocking signals before child birth
[06-Feb-2024 11:04:49.395351] DEBUG: pid 85554, fpm_children_make(), line 454: unblocking signals, child born
[06-Feb-2024 11:04:49.395602] DEBUG: pid 85554, fpm_children_make(), line 460: [pool www] child 85609 started
[06-Feb-2024 11:04:49.395736] DEBUG: pid 85554, fpm_pctl_on_socket_accept(), line 553: [pool www] got accept without idle child available .... I forked
[06-Feb-2024 11:04:49.395882] DEBUG: pid 85554, fpm_event_loop(), line 435: event module triggered 1 events
[06-Feb-2024 11:04:49.413857] DEBUG: pid 85554, fpm_got_signal(), line 82: received SIGCHLD
[06-Feb-2024 11:04:49.416453] DEBUG: pid 85554, fpm_event_loop(), line 435: event module triggered 1 events
[06-Feb-2024 11:04:49.417548] WARNING: pid 85554, fpm_children_bury(), line 281: [pool www] child 85609 exited on signal 6 (SIGABRT) after 0.021964 seconds from start
[06-Feb-2024 11:04:49.417756] DEBUG: pid 85554, fpm_children_make(), line 430: blocking signals before child birth
[06-Feb-2024 11:04:49.421868] DEBUG: pid 85554, fpm_children_make(), line 454: unblocking signals, child born
[06-Feb-2024 11:04:49.422117] NOTICE: pid 85554, fpm_children_make(), line 460: [pool www] child 85611 started
[06-Feb-2024 11:04:50.031248] DEBUG: pid 85554, fpm_pctl_perform_idle_server_maintenance(), line 382: [pool www] currently 0 active children, 1 spare children

But I expected this output instead:

done

% uname -a
Darwin ian.local 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct  9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000 arm64
% sw_vers -ProductVersion
14.1.2
/opt/local/bin/php83 -v
PHP 8.3.2 (cli) (built: Jan 26 2024 23:59:55) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.2, Copyright (c) Zend Technologies

% /opt/local/bin/php81 -v
PHP 8.1.27 (cli) (built: Jan  9 2024 01:07:36) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.27, Copyright (c) Zend Technologies
% otool -L /opt/local/lib/php83/extensions/no-debug-non-zts-20230831/pgsql.so
/opt/local/lib/php83/extensions/no-debug-non-zts-20230831/pgsql.so:
	/opt/local/lib/postgresql15/libpq.5.dylib (compatibility version 5.0.0, current version 5.15.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.0.0)

% otool -L /opt/local/lib/php81/extensions/no-debug-non-zts-20210902/pgsql.so 
/opt/local/lib/php81/extensions/no-debug-non-zts-20210902/pgsql.so:
	/opt/local/lib/postgresql15/libpq.5.dylib (compatibility version 5.0.0, current version 5.15.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.0.0)

PHP Version

8.3.2, 8.2.15, 8.1.27

Operating System

macOS 14.1.2


Config Files

php83-fpm.conf.txt
php83-www.conf.txt
php81-fpm.conf.txt
php81-www.conf.txt

% wdiff -3 php81/php-fpm.conf php83/php-fpm.conf

======================================================================
 [-run/php81/php-fpm.pid-] {+run/php83/php-fpm.pid+}
======================================================================
 [-log/php81/php-fpm.log-] {+log/php83/php-fpm.log+}
======================================================================
 [-php81-fpm-] {+php83-fpm+}
======================================================================

[-include=/opt/local/etc/php81/php-fpm.d/*.conf-]
{+include=/opt/local/etc/php83/php-fpm.d/*.conf+}
======================================================================
% wdiff -3 php81/php-fpm.d/www.conf php83/php-fpm.d/www.conf 

======================================================================
 {+Linux,+}
======================================================================


{+; Set the associated the route table (FIB). FreeBSD only
; Default Value: -1
;listen.setfib = 1+}
======================================================================
 [-prctl)-] {+prctl for Linux or
; PROC_TRACE_CTL procctl for FreeBSD)+}
======================================================================
 [-/opt/local/share/examples/php81/fpm/status.html-] {+/opt/local/share/examples/php83/fpm/status.html+}
======================================================================
 {+A list of request_uri values which should be filtered from the access log.
;
; As a security precuation, this setting will be ignored if:
;     - the request method is not GET or HEAD; or
;     - there is a request body; or
;     - there are query parameters; or
;     - the response code is outwith the successful range of 200 to 299
;
; Note:+}
======================================================================
 {+paths are matched against the output of the access.format tag "%r".
;       On common configurations, this may look more like SCRIPT_NAME than the
;       expected pre-rewrite URI.
;
; Default Value: not set
;access.suppress_path[] = /ping
;access.suppress_path[] = /health_check.php

; The+}
======================================================================

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions