-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
ErrPktTooLarge message may be incorrect #1355
Comments
You are right. The error message is misleading. And I don't want to recommend to use DSN. We need to move much documentations from DSN readme to Config object. |
And current default value (4MiB) is too small. MySQL uses 16MiB by default. |
Hi @methane. Thanks for confirming what I suspected. I've seen various references to the |
Actually looking here the 8.0 default seems to be 64MB. Either way it's larger than the previous 5.7 default value. |
Here is the way to get the value used for your connection: SELECT @@max_allowed_packet; |
I see no movement on this issue. Can it be resolved? I think it is at least confusing if the mysql driver reports an error which is what the server reports but is triggered by the client configuration setting being wrong. Perhaps provide in the error message the golang client setting of max_allowed_packet that's being used which will give context to the person who sees the error which value was configured on the client. The server's setting may need to be adjusted but if the client configuration setting is not adjusted then it won't make any difference. So improving the error message would be useful. |
Thanks very much for making the change! |
Issue description
See: https://jira.percona.com/browse/DISTMYSQL-226 for context.
An application, orchestrator, using the go-mysql-driver is reporting an error
ErrPktTooLarge
. The error message states"packet for query is too large. Try adjusting the 'max_allowed_packet' variable on the server"
which I think may be incorrect or misleading.The application does not set
maxAllowedPacket
explicitly via the DSN in the go driver, so I assume that the default value is being used: https://github.com/zendesk/go-sql-driver-mysql/blob/master/const.go#L13 which is 4 MB.The MySQL server has a configuration setting of
max_allowed_packet = 64MB
.Error log
Not really applicable but for context:
Configuration
Driver version (or git SHA):
1.6 (part of orchestrator's vendor tree)
Go version: run
go version
in your consolenot 100% sure but "recent".
Server version: E.g. MySQL 5.6, MariaDB 10.0.20
Server OS: E.g. Debian 8.1 (Jessie), Windows 10
Expected behaviour
In this case I expect the error is that the application has not set a large enough
maxAllowedPacket
value, the application is trying to send a SQL statement which is too large and the driver is correctly reporting an error.However, the error message is wrong: the problem here is that the default setting used by the client is too small, the server side setting is probably fine.
The error should be:
e.g. This is a trivial change to the constant message that is being given.
I can provide a trivial PR for this if needed, but want to see if you agree that the current error message may incorrectly indicate the actual action to take.
The text was updated successfully, but these errors were encountered: