Bug #80730 [Fbk->Opn]: Random segfault PDO fetch_value
| From: | ricardo dot branco at covermg dot com | Date: | Wed, 10 Feb 2021 21:57:30 +0000 |
| Subject: | Bug #80730 [Fbk->Opn]: Random segfault PDO fetch_value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-232045@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80730&edit=1
ID: 80730
User updated by: ricardo dot branco at covermg dot com
Reported by: ricardo dot branco at covermg dot com
Summary: Random segfault PDO fetch_value
-Status: Feedback
+Status: Open
Type: Bug
Package: PDO MySQL
Operating System: Centos 7
PHP Version: 7.4.15
Block user comment: N
Private report: N
New Comment:
The problem does not happen 100% of the time nor is it reproducible on demand, I see it randomly
without any specific reason and even when I run it against the same job it crashed on before, it
does it successfully.g
This machine is currently only running 3 PHP scripts, they are long running but restarted once per
hour just incase of any memory leaks.
The only portion of code I can track this down too is a part that just requests a single row of data
from the DB, its nothing large. This is going though ZF1 Zend_Db lib but should not matter here as
it seems to be going wrong in the PDO lib.
MariaDB 10.4.15
memory_limit = 64M
No persistent DB connections (long running script, it starts and disconnects conn within the Gearman
loop as needed)
Ive registered a tick handler to monitor the memory and additional logging to confirm the area it
stopping on.
```
total used free shared buff/cache available
Mem: 1882004 338520 275664 102100 1267820 1260372
Swap: 524284 68392 455892
```
```
[2244970.641111] traps: php[22014] general protection ip:56336a0fb0d1 sp:7ffe3944afc8 error:0
[2249179.087888] traps: php[24166] general protection ip:56407225f0d1 sp:7ffd703631d8 error:0 in
php[564072200000+1ff000]
[2249213.888219] traps: php[23898] general protection ip:55b6ea2ba492 sp:7ffe9cf2a290 error:0
[2261617.050534] traps: php[24174] general protection ip:563eb45950d1 sp:7ffd2efb4548 error:0
```
Previous Comments:
------------------------------------------------------------------------
[2021-02-10 20:56:11] dharman@php.net
There doesn't seem to be a lot of information in this bug report that could help us reproduce
the issue. Could you provide any more information, please? Can you at least identify minimal
reproducible code example? Which MySQL version are you running? The error comes from emalloc so can
you let us know your memory limit settings in INI and your system memory (total/free). How large is
the result that you are expecting?
------------------------------------------------------------------------
[2021-02-10 18:23:06] ricardo dot branco at covermg dot com
Description:
------------
We are seeing random segfaults in PDO module when running script and not able to diagnose what the
issue is. Looking at where the script crashes. If we restart the script it goes does the same
process again without issue.
Could this be unhandled loss of DB connection in the PDO driver?
```
(gdb) bt
#0 0x0000563eb45950d1 in _emalloc ()
#1 0x00007fb0b0318c5e in fetch_value () from /opt/remi/php74/root/usr/lib64/php/modules/pdo.so
#2 0x00007fb0b031b2df in do_fetch.constprop.9 () from
/opt/remi/php74/root/usr/lib64/php/modules/pdo.so
#3 0x00007fb0b031c673 in zim_PDOStatement_fetchAll () from
/opt/remi/php74/root/usr/lib64/php/modules/pdo.so
#4 0x0000563eb4640e5c in execute_ex ()
#5 0x0000563eb45ac016 in zend_call_function ()
#6 0x0000563eb45ac215 in _call_user_function_ex ()
#7 0x00007fb0acc32b52 in _php_worker_function_callback () from
/opt/remi/php74/root/usr/lib64/php/modules/gearman.so
#8 0x00007fb0aca09167 in FunctionV1::callback(gearman_job_st*, void*) () from
/lib64/libgearman.so.8
#9 0x00007fb0aca11ffc in gearman_worker_work () from /lib64/libgearman.so.8
#10 0x00007fb0acc33e9d in zif_gearman_worker_work () from
/opt/remi/php74/root/usr/lib64/php/modules/gearman.so
#11 0x0000563eb4640e5c in execute_ex ()
#12 0x0000563eb4641961 in zend_execute ()
#13 0x0000563eb45ba9b3 in zend_execute_scripts ()
#14 0x0000563eb4559170 in php_execute_script ()
#15 0x0000563eb4643adc in do_cli ()
#16 0x0000563eb43bf7cb in main ()
```
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80730&edit=1