[MDEV-25526] CentOS 7 + PHP PDO + MariaDB randomly empty SELECT result Created: 2021-04-26  Updated: 2021-04-30  Resolved: 2021-04-30

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.2.37, 10.3.28, 10.4.18, 10.5.9
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: stanley h Assignee: Vicențiu Ciorbaru
Resolution: Not a Bug Votes: 0
Labels: None

Attachments: File db_test.php     File db_test.php    

 Description   

I spent many many days and weeks with very very specific and random problem.

CREATE TABLE IF NOT EXISTS `datas`
(
`id` varchar(32) NOT NULL,
`access` int(10) unsigned DEFAULT NULL,
`data` text NULL,
PRIMARY KEY (`session_id`)
) ROW_FORMAT = DYNAMIC
ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci;

Put data like this:

INSERT INTO `datas` VALUES ('18041vivf9us088dluinh6ip02', 1619455120, 'd/lQRoGhOEIQn+bFpfZkfg==:Tzu6URdU5qSRh3ih4cfU6w==');

Then create PHP PDO connection and simple query like into test.php:

SELECT * FROM datas WHERE id="18041vivf9us088dluinh6ip02";

Create cron like this:

"* * * * * php74 /path_to_script/test.php"

I believe that after some time you will see that php fetchAll() or fetch() will return empty result.

After I replaced DB to MySQL 5.7 than result will ALWAYS return requested row.

I think that some combination broken MariaDB stability, because my VPS server has enough memory, enough cpu capacity, enough disk space. Other services working well, no other problem and soo on. PHP is from Remi repository for example 7.4 version. MariaDB repo is original mariadb. I tested with all, but my main test was on 10.5.9 version. Tested on CentOS Linux release 7.9.2009 (Core). Core Linux 3.10.0-1160.21.1.el7.x86_64 (SMP).



 Comments   
Comment by Vicențiu Ciorbaru [ 2021-04-26 ]

Hi standus, what version of MariaDB are you using?

Comment by Daniel Black [ 2021-04-26 ]

Can you attach your test.php script?

Comment by Vicențiu Ciorbaru [ 2021-04-27 ]

standus I've downgraded the Issue priority to Critical, as this being a potential race condition isn't something that affects a significant number of users. Nonetheless, please provide us your test.php script so we can have an easier time trying to reproduce this, we do not write php scripts as our day-to-day tasks.

Comment by stanley h [ 2021-04-27 ]

db_test.php

Comment by stanley h [ 2021-04-30 ]

I found that problem is that my server is restarting every day self. Please close it.

Generated at Thu Feb 08 09:38:22 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.