[CONJ-770] [AURORA] - Seeing seemingly random connection resets when using aurora read/write cluster Created: 2020-03-10 Updated: 2022-08-16 Resolved: 2022-08-16 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | aurora |
| Affects Version/s: | 2.5.3 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | M Z | Assignee: | Diego Dupin |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
We have recently switched to the MariaDB Java Client for our Aurora RDS cluster to utilize the read/write balancing. However, we occasionally (roughly once a day) see connection reset errors. We enabled `enablePacketDebug` to see if we can find what is causing this, and it seems to be a transition from write to read only. The following are 3 examples of what was executed according to `enablePacketDebug` before the connection reset errors occurred:
any help with this would be highly appreciated. |
| Comments |
| Comment by Diego Dupin [ 2020-03-10 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
What do you mean exactly by connection reset ?
has been called. That can be by application, or more probably occurs after a socket fails: connectors automatically create a new connection, and set database, transaction level according to the state of previous connection. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by M Z [ 2020-03-10 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Ah sorry, what I mean is the following exception occurs:
I thought the enablePacketDebug option logs the packets that were sent before the error occured? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Diego Dupin [ 2020-03-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This error means that a TCP RST was received, so socket was closed by server, not because of some network issue. After that you've got to discover why server has close connection. I would recommand to check those server values. default value is 28800s (8h) might it be possible that some connection have been idle for that amount of time ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by M Z [ 2020-03-11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi, thank you for your reply. The wait_timeout is the default at 8h and our HikariPool has:
the
is 60 seconds.
and the timestamp of the exception:
it doesn't seem to be a timeout issue. Could it be something else that's causing this? Maybe it's the transition from writer to reader that sometimes resets the tcp socket? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Diego Dupin [ 2020-03-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
What i don't understands is that "java.net.SocketException: Connection reset" occurs when reading from socket, so RST was sent from server AFTER driver send a command (driver doesn't read from socket if there is no command send) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Diego Dupin [ 2020-03-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
For your previous message, I think those timestamps doesn't say anything:
We can remote wait_timeout from the equation, but net_write_timeout can still be the problem: One example :
This usually goes with command with big resultset and using setFetchSize : when using fetchSize, driver read only one row at a time, to avoid staturating memory with all data. Problem is that if application traitement on those rows takes more than 60s, this will result in this kind of issue. Could you identify if there is some queries that would correspong to this at this time (batches usually) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by M Z [ 2020-03-13 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thank you, I will increase `net_write_timeout` and observe and report back next week. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Diego Dupin [ 2020-03-17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
btw, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by M Z [ 2020-03-17 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Ah yes, that explains why the ConnectionID reported by the packetDebug only shows up after the issue occurred in the audit log. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by M Z [ 2020-03-18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Unfortunately, the connection resets happened again this morning. 3 in a row. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Diego Dupin [ 2020-03-18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
When server send an RST, MariaDB server logs the reason. I don't know the logs aurora offer, but i would recommend go that way first, but sure, 2.6.0 can help. (release will be probably end of this week, of the week after) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by M Z [ 2020-03-18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Unfortunately, I do not see any logging related to RST. Hopefully the fixed packet debugging will shed some light onto this. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Diego Dupin [ 2020-03-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
hm, i'm thinking of another possibility : if your application use connection.abort. Aurora send a fake thread id, on connection. Abort will kill the connection with this thread id. Do you use connection.abort ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by M Z [ 2020-03-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Not knowlingly, we do not work on Connection level. We use Spring JPA/Hibernate, but I'm not sure if these Frameworks use Connection.abort to be honest. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Diego Dupin [ 2020-03-24 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
In fact this is more a pool thing, and i've forgot that you use hikaricp that only does abort when closing the pool which is only done for testing. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by M Z [ 2020-03-31 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Due to the current situation, we are not allowed to deploy to the production environment. Luckily (or maybe un-luckily) this issue now also happened on our dev environment with the 2.6.0 Version. Unfortunately, the packetDebug only shows a bunch of cryptic numbers and select queries from a background job that worked 4 hours prior without issue. Is there anything else I can do to get to the bottom of this? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Diego Dupin [ 2020-03-31 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
If you have some packetDebug please post them here. we never know, it might help. Since server close the connection, the best thing is to check server logs. I don't know for aurora, but normally server logs why it close a connection. That might be completly wrong, but this is the first time i've seen a task for aurora with protocol compression. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by M Z [ 2020-04-01 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I'm afraid that I am probably not allowed to share the packetDebug logs due to company policy. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by M Z [ 2020-04-16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Below is a packetDebug log where I removed the query due to company policy:
And these are the parameters we use for our connection, maybe we configure something wrong? Because it really happens in all our applications that recently switched to MariaDB and they all use very similar parameters:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by M Z [ 2020-04-16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Another interesting thing we just found in the audit log of aurora:
reset timestamp:
Does that mean the connection reset happened on client side? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by M Z [ 2020-04-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Gentle ping | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by M Z [ 2020-05-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
We have 'reverted' back to the mysql connector and are now seeeing: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Diego Dupin [ 2022-08-16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
closing as requested |