[php-src] Issue #12974: Apache crashes on shutdown when using pg_pconnect()
| From: | stable-staple | Date: | Tue, 19 Dec 2023 12:09:35 +0000 |
| Subject: | [php-src] Issue #12974: Apache crashes on shutdown when using pg_pconnect() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246074@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12974
Author: stable-staple
### Description
**Problem Scenario:**
Start Apache (version 2.4.58).
Execute any PHP script that uses pg_pconnect function to establish a PostgreSQL persistent database
connection (host=<host> port=<port> dbname=<dbname> user=<user>).
Stop Apache.
**Observed Behavior:**
After stopping Apache, dump files are generated.
The dump files include backtrace information:
```
EXCEPTION_RECORD: (.exr -1)
ExceptionAddress: 00007ffe1399c5a0 (php_pgsql+0x000000000000c5a0)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 0000000000000008
Parameter[1]: 00007ffe1399c5a0
Attempt to execute non-executable address 00007ffe1399c5a0
...
00000098
27eff2e8 00007ffe0e8b048a : 0000021e610ff298 0000021e61233070
0000021e5c7cf510 0000021e59870000 : php_pgsql+0xc5a0
0000009827eff2f0 00007ffe0e8828b2 : 0000000000000000 00007ffe00000000
0000000000000168 00007ffe313237eb : php8ts!zend_register_list_destructors_ex+0x10a
0000009827eff320 00007ffe0e7d47ca : 0000000000000009 0000000000000009
0000000000000168 0000021e59870000 : php8ts!zend_hash_graceful_reverse_destroy+0x1d2
0000009827eff370 00007ffe0e947d52 : 0000000000000000 0000000000000000
0000021e59919438 00007ffe313237eb : php8ts!zend_append_version_info+0xcba
0000009827eff3a0 00007ffe0e7d1982 : 0000021e59919458 000000005a27cb50
0000021e59919438 0000000000000000 : php8ts!ts_free_id+0xc2
0000009827eff3f0 00007ffe0e91bab6 : 0000021e5c0be2b8 0000000000000000
0000021e5c0be168 0000000000000000 : php8ts!zend_alloc_ce_cache+0x6c2
0000009827eff420 00007ffe0e91bb49 : 0000021e5c0be1e0 0000021e614951b0
0000000000000000 0000021e5987ae50 : php8ts!php_module_shutdown+0x36
0000009827eff450 00007ffe2a343288 : 0000021e5987ae50 0000021e5c0be188
0000021e59894f70 000000005a27cb50 : php8ts!php_module_shutdown_wrapper+0x9
0000009827eff480 00007ffe0fbdffbe : 0000021e5987ae50 0000021e599133e0
0000000000000000 000000000000ea60 : php8apache2_4+0x3288
0000009827eff4b0 00007ffe0fbdf429 : 0000000000000000 000000005a27cb50
000000000000ea60 000000005a27cb50 : libapr_1!apr_pool_userdata_get+0xe348
0000009827eff4e0 000000005a23983c : 0000000000000000 000000005a27cb50
0000000000000780 0000000000000001 : libapr_1!apr_pool_userdata_get+0xd7b3
0000009827eff510 000000005a23f59c : 0000000000000017 0000021e5987ae50
0000021e598c43f8 000000005a2512b6 : libhttpd!ap_get_server_revision+0x2766c
0000009827eff5e0 000000005a243e3b : 0000021e5987ae50 0000021e598dc0a8
0000000000000000 0000021e5988938f : libhttpd!ap_get_server_revision+0x2d3cc
0000009827eff630 00007ff7878922bb : 000000005a297028 0000021e598a2678
0000009827eff6c9 0000021e5989f2d0 : libhttpd!ap_get_server_revision+0x31c6b
0000009827eff660 00007ff787893c28 : 0000000000000003 0000021e5988a730
0000000000000064 0000000000000000 : tc_webmgr+0x22bb
0000009827eff730 00007ffe31d6257d : 0000000000000000 0000000000000000
0000000000000000 0000000000000000 : tc_webmgr+0x3c28
0000009827eff770 00007ffe33f8aa58 : 0000000000000000 0000000000000000
0000000000000000 0000000000000000 : kernel32!BaseThreadInitThunk+0x1d
0000009827eff7a0 0000000000000000 : 0000000000000000 0000000000000000
0000000000000000 0000000000000000 : ntdll!RtlUserThreadStart+0x28
```
**Expected Outcome:**
The script should execute without issues.
```
```
### PHP Version
8.1.25
### Operating System
Windows 11