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

[ERROR] RECEIVED AN UNKNOWN COMMAND: 31 -- PLEASE REPORT A BUG #2021

Closed
nicolasgarfinkiel opened this issue Apr 17, 2019 · 17 comments · Fixed by #3645
Closed

[ERROR] RECEIVED AN UNKNOWN COMMAND: 31 -- PLEASE REPORT A BUG #2021

nicolasgarfinkiel opened this issue Apr 17, 2019 · 17 comments · Fixed by #3645

Comments

@nicolasgarfinkiel
Copy link

Hello,

Using MySqlConnector client for .NET (https://github.com/mysql-net/MySqlConnector) I get the following error in ProxySQL, version 2.0.:

[ERROR] RECEIVED AN UNKNOWN COMMAND: 31 -- PLEASE REPORT A BUG

Looking at the source code I see that [1f] COM_RESET_CONNECTION (31) is not implemented in MySQL_Session.cpp, I see _MYSQL_COM_RESET_CONNECTION in proxysql_structs.h, but it is not used.

Any chance that it can be implemented? Maybe temporarily using change user functionality?

Thanks in advance!

@renecannao
Copy link
Contributor

Hi @nicolasgarfinkiel .
Indeed, COM_RESET_CONNECTION is not implemented yet.

Thank you for the report.

@Sefiris
Copy link

Sefiris commented May 27, 2019

This error occurs on the following version: proxysql-1.4.12-1.2.el7.x86_64 as well.
Right now this is not a major issue for us, just the proxysql.log being spammed
Is there any way to stop this from happening by any chance? maybe a MySqlConnector option?

@rohitkeshwani07
Copy link

did u find a workaround @nicolasgarfinkiel ??

@nicolasgarfinkiel
Copy link
Author

Hi @rohitkeshwani07, sorry for the late reply. The workaround was to specify in the client to use 5.7 version of MySQL protocol to force use of COM_CHANGE_USER instead of COM_RESET_CONNECTION (that's command 31). They are basically the same, one being more lightweight than the other. Besides, in my use case there was no need to connect with a higher protocol version, even if using MySQL and sending queries that rely on MySQL 8+.

@rohitkeshwani07
Copy link

I am guessing you did that by specifying server_version="5.7.23-logSourcedistribution" in proxysql conf. It didn't work for me.

@nicolasgarfinkiel
Copy link
Author

Nope, that's something you specify at client level, ie: MySqlConnector

@rohitkeshwani07
Copy link

rohitkeshwani07 commented Jun 7, 2020

ok... Don't u think, if proxysql is informing version as 5.7 to the client... as it picks from server_version... client should use 5.7 protocol.

@peppy
Copy link

peppy commented Jul 19, 2020

I just noticed (due to server disk space filling up) that I am seeing this in my logs hundreds of times per second.

What is the path forward here? Is there a way to silence these logs or fix clients? I am unable to downgrade to 5.7 protocol on some of my connecting clients so the above "workaround" is not an easy solution for me.

@nicolasgarfinkiel
Copy link
Author

@peppy With MySqlConnector setting client version to 5.7 only affects the way the connection is cleaned up when it returns to the pool, instead of using COM_RESET_CONNECTION (31), it uses COM_CHANGE_USER. The former is a lighter version of the latter, but it does not affect performance whatsoever.

However, I dunno if changing the client version on other platforms affects client another behaviour.

@peppy
Copy link

peppy commented Jul 21, 2020

Unfortunately it does affect behaviour for us (laravel sends commands with proxysql cannot handle if set to 5.x). Is there any other solution?

@rohitkeshwani07
Copy link

@peppy
laravel sends commands with proxysql cannot handle if set to 5.x

i think that is just
https://github.com/laravel/framework/blob/0b12ef19623c40e22eff91a4b48cb13b3b415b25/src/Illuminate/Database/Connectors/MySqlConnector.php#L180

u can overwrite this function

@rohitkeshwani07
Copy link

rohitkeshwani07 commented Jul 22, 2020

Also this is happening for me only when we run an alter query directly on mysql without going from proxysql... so we decided to stop proxysql when running alters.

you may want to test this as well.

@peppy
Copy link

peppy commented Jul 28, 2020

Is there any way to get an actual fix for this pushed? We've fixed laralvel, but I have JDBC connectors which are also complaining about the version mismatch (trying to access query_cache_size which doesn't exist, for instance) and this really feels like a weird oversight which should be simple to fix (at very least just have the ability to silence the error).

@mishunn
Copy link

mishunn commented Jun 21, 2021

@renecannao
Is it planned to support COM_RESET_CONNECTION in proxysql v2?

@angrygreenfrogs
Copy link

FYI - I ran into this same problem with our .NET connector code in an older .NET Core 2.1 application (using MySqlConnector 0.57.0).

I found that setting mysql-server_version to 5.5.0 resolved the problem, although I admit to not knowing exactly why that worked.

We originally set mysql-server_version to 5.7.32-log to match our Azure MySQL server, but then we had this problem spamming our logs constantly.

UPDATE global_variables SET variable_value='5.5.0' WHERE variable_name='mysql-server_version';
LOAD MYSQL VARIABLES TO RUNTIME;
SAVE MYSQL VARIABLES TO DISK;
PROXYSQL RESTART;

JavierJF added a commit that referenced this issue Sep 28, 2021
JavierJF added a commit that referenced this issue Sep 28, 2021
JavierJF added a commit that referenced this issue Sep 28, 2021
renecannao added a commit that referenced this issue Nov 19, 2021
Added support for 'COM_RESET_CONNECTION' and 'COM_CHANGE_USER' fixes - Closes #2021
@peppy
Copy link

peppy commented Nov 20, 2021

Thanks so much for making this fix happen! Will give it a test when it hits a release.

JavierJF added a commit that referenced this issue Dec 2, 2021
JavierJF added a commit that referenced this issue Dec 2, 2021
renecannao added a commit that referenced this issue Dec 6, 2021
Added support for 'COM_RESET_CONNECTION' and 'COM_CHANGE_USER' fixes - Closes #2021
@feiazifeiazi
Copy link

Release it quickly.

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

Successfully merging a pull request may close this issue.

8 participants