Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClientPool concurrency issue with PDO. Queried data conflicts. #320

Open
elarmust opened this issue Jul 26, 2023 · 0 comments
Open

ClientPool concurrency issue with PDO. Queried data conflicts. #320

elarmust opened this issue Jul 26, 2023 · 0 comments

Comments

@elarmust
Copy link

elarmust commented Jul 26, 2023

  1. What did you do? If possible, provide a simple script for reproducing the error.
    Run large number of mysql queries in parallel inside http server on('request') method.

Step 1:
Create a ClientPool like this.
image

Step 2:
Create a wrapper function to query data and manage connection:
image

Step 3:
Run large number of parallel queries. For example, create a basic http server and query the data like this.
image

Step 4:
Open the website in 2 different browsers at the same time.

  1. What did you expect to see?
    Each request receives the correct data. For simple visual data verification, I used PHPSESSID cookie.
3. What did you see instead?

Data is getting mixed up between multiple queries running in parallel.
image

4. What version of OpenSwoole are you using (show your `php --ri openswoole`)?

official docker image version 22.0.0

5. What is your machine environment used (show your `uname -a` & `php -v` & `gcc -v`) ?

Linux 66d70d353f35 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 Linux

PHP 8.2.5 (cli) (built: Apr 14 2023 18:00:14) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.5, Copyright (c) Zend Technologies

/bin/sh: gcc: not found ????

Additionally, this error is not reproducible when running them in parallel like this:
image

This issue did not show up when i tried Swoole

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants