-
Notifications
You must be signed in to change notification settings - Fork 976
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
packets out of order. expected 1 received 27 #1574
Comments
Hi @Barbery . |
Hi @renecannao , |
I've seen this in laravel application specifically using percona DB. I'd try to switch to mysql 5.6 and can't reproduce this. PDO::ATTR_EMULATE_PREPARES => true still the workaround I use since I can't use mysql plain, for political reason. |
I'm also running into this issue at my workplace, and also unable to reliably reproduce it. We have three web servers behind a load balancer, where each web server is running Laravel and using its own instance of proxysql to connect to a Percona database cluster of 3 database servers. The issue has occurred exactly 6 times on each web server over the last week; it had previously occurred a handful of times in May, and then not at all for about 2 months. This most recent set of errors occurred after a Laravel database migration, though we have no idea why this migration would cause these "packets out of order" errors (so maybe the migration didn't actually have anything to do with the errors). |
We are experiencing the same problem and also have trouble debugging it. Our setup consists of 2 web servers running Laravel 5.6, with ProxySQL on each of them. They connect with 3 MySQL 5.7 servers where one of them acts as the master. It seems to occur after Laravel ran a database migration and queries are being run on migrated tables afterwards. As soon as I restarted both instances of ProxySQL the errors disappeared. |
We've seen this happen twice right after a Laravel migration. Code that Laravel was executing is nothing special and problems disappear immediately after rolling back the schema update:
Sounds to me as if ProxySQL and the underlying Percona XtraDB Cluster have different ideas about the size of the records after the migration. Could there be a way that Laravel constructs the query that makes ProxySQL miss flushing some cache? (I have not read the code, just voicing some thoughts) |
Having had a brief look at the code, it looks like queries are cached and only purged based on their TTL or when the maximum amount of cache memory is reached. Ideally there should be some code that discards cached queries that use tables that are used in an 'ALTER' statement. Code that would just flush all caches on an 'ALTER' statement would also suffice. |
hi, @renecannao I crafted a reproducible test case here: https://gist.github.com/cofyc/6608768c353e208428afef12dda01cb7 PTAL 1, start MySQL 5.6
2, start a proxysql (2.0.9)
(this bug also exists in proxysql 2.0.14) 3, run test script with php php -f test.php https://gist.github.com/cofyc/6608768c353e208428afef12dda01cb7#file-test-php 4,change the schema of the table to trigger the error mysql -h 127.0.0.1 -P6033 -uroot -proot -e 'alter table test.sbtest10 add f11 bigint AFTER id;' 5, check the error logs proxysql outputs the follow error message:
|
It does indeed look like the switch statement here is missing a case for |
I got the same problem with Laravel migration to alter add new columns |
@renecannao |
Cross reference to #1128 . |
Purely out of interest, why does ProxySQL not support client side cursors? is it a technical limitation, or just not implemented?
Laravel's Database access is via Eloquent ORM, which is using Doctrine underneath, which directly uses php mysqli functions, if that helps. https://github.com/doctrine/dbal/ |
Closes #1574: Packets out of order. expected 1 received 27.
Closes #1574: Packets out of order. expected 1 received 27.
ProxySQL v2.3.2 and older, problem persists Using php 7.4 / mysqli (mysqlnd 7.4.20) |
@An-Tux : |
@An-Tux : |
Hello, I've seen a similar issue today on proxysql 2.4.2-38-gcf029cc After executing a couple of I suddenly found this in proxysql log when trying to select from that table: MySQL_PreparedStatement.cpp:388:update_metadata(): [WARNING] Updating metadata for stmt 38 , user shop, query select * from We are also using laravel. Executing the same call in lavarel repeatedly sometimes delivered the correct answer, but mostly not. After restarting the proxysql deployment the warnings disappeared and the laravel call delivered consistent answers again. |
I encountered the same issue. Is there any solution available now? |
Hi, in my production environment, if I run some migration file(create table or alter field), sometimes PHP will throw the exception "packets out of order. expected xx received xx".
And I found that:
PDO::ATTR_EMULATE_PREPARES => true
, all is fine, but that will make all int type force cover to stringIs something way to solve this problem and don't force cover int to string?
The text was updated successfully, but these errors were encountered: