Skip to content

ErrPktTooLarge message may be incorrect #1355

Closed
@sjmudd

Description

@sjmudd

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:

2022-09-26T11:53:51.837501+02:00 orchestratorapp.example.com orchestrator[11887]: 2022-09-26 11:53:51 ERROR flushInstanceWriteBuffer: 2022-09-26 11:53:51 ERROR flushInstanceWriteBuffer last_seen: packet for query is too large. Try adjusting the 'max_allowed_packet' variable on the server
2022-09-26T11:53:51.837569+02:00 orchestratorapp.example.com orchestrator[11887]: packet for query is too large. Try adjusting the 'max_allowed_packet' variable on the server
2022-09-26T11:53:51.837645+02:00 orchestratorapp.example.com orchestrator[11887]: flushInstanceWriteBuffer: 2022-09-26 11:53:51 ERROR flushInstanceWriteBuffer last_seen: packet for query is too large. Try adjusting the 'max_allowed_packet' variable on the server

Configuration

Driver version (or git SHA):

1.6 (part of orchestrator's vendor tree)

Go version: run go version in your console

not 100% sure but "recent".

Server version: E.g. MySQL 5.6, MariaDB 10.0.20

  • MySQL 8.0.30

Server OS: E.g. Debian 8.1 (Jessie), Windows 10

  • Linux / CentOS 8

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:

ErrPktTooLarge = errors.New("packet for query is too large. Try setting or increasing 'maxAllowedPacket' in the DSN or adjusting the 'max_allowed_packet' variable on the server")

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions