Bug #105472 Report username/host/socket in error MY-013129 or maybe MY-001158
Submitted: 5 Nov 2021 12:33 Modified: 6 Nov 2021 7:29
Reporter: Simon Mudd (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Logging Severity:S4 (Feature request)
Version:8.0.26 OS:Any
Assigned to: CPU Architecture:Any
Tags: disconnections, enhancement, logging

[5 Nov 2021 12:33] Simon Mudd
Description:
I see quite a few logs with this:

2021-11-04T09:15:02.638678Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001158 - Got an error reading communication packets
2021-11-04T09:15:02.638693Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001158 - Got an error reading communication packets
2021-11-04T09:15:02.639117Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001158 - Got an error reading communication packets
2021-11-04T09:15:02.639155Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001158 - Got an error reading communication packets

Some MySQL servers I manage have tens of thousands of connections from a large number of different hosts.

The above information is unhelpful as it does not indicate the most important information:
- client username
- client host/socket

This would allow me to determine if the same user has a problem, if the problem is from a specific host or it is a generic problem. Right now that information is not available and resolving this should be straight-forward.

How to repeat:
Check logging on a server which has such error messages.

Suggested fix:

Improve logging along the lines of:

2021-11-04T09:15:02.639155Z 0 [ERROR] [MY-013129] [Server] A message intended for a client 'some_user'@'some-host.com' cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001158 - Got an error reading communication packets

Using the ip address also works but I think the performance_schema.host_cache already handles this.
[6 Nov 2021 7:29] MySQL Verification Team
Hello Simon,

Thank you for the feature request!

regards,
Umesh