Repository navigation
Commit 9758d21
authored
Fixes #1786
When the server closes an idle connection after `wait_timeout`, MySQL first sends an ERR packet (4031, `ER_CLIENT_INTERACTION_TIMEOUT`). With no command in flight, `MySQLDecoder` threw `IllegalStateException("No command codec for packet")` and the server's reason was lost.
`MySQLDecoder` now decodes an unsolicited ERR packet and fails with a `MySQLException`. Other unexpected packets still throw `IllegalStateException`.
`MySQLCommand#decodeErrorPacketPayload` and `MySQLCommand#readRestOfPacketString` are now `static` so the decoder can use them.
`MySQLPoolTest#testBorrowedPooledConnectionClosedByServer` now asserts that the connection `exceptionHandler` receives a `MySQLException` with error code 4031. The assertion is skipped on MariaDB, which closes the socket without sending an ERR packet.
Assisted-by: IBM Bob
(cherry picked from commit b9c4b4b)
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
1 parent a846bdf commit 9758d21
3 files changed
Lines changed: 18 additions & 2 deletions
File tree
- vertx-mysql-client/src
- main/java/io/vertx/mysqlclient/impl/codec
- test/java/io/vertx/tests/mysqlclient
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
76 | 82 | | |
77 | 83 | | |
78 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
146 | 156 | | |
147 | 157 | | |
148 | 158 | | |
| |||
0 commit comments