This repository was archived by the owner on Jan 21, 2022. It is now read-only.
File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ Runrioter Wung <runrioter at gmail.com>
60
60
Soroush Pour <me at soroushjp.com>
61
61
Stan Putrya <root.vagner at gmail.com>
62
62
Stanley Gunawan <gunawan.stanley at gmail.com>
63
+ Thomas Parrott <tomp at tomp.uk>
63
64
Xiangyu Hu <xiangyu.hu at outlook.com>
64
65
Xiaobing Jiang <s7v7nislands at gmail.com>
65
66
Xiuming Chen <cc at cxm.cc>
Original file line number Diff line number Diff line change @@ -46,8 +46,15 @@ func (mc *mysqlConn) readPacket() ([]byte, error) {
46
46
if data [3 ] > mc .sequence {
47
47
return nil , ErrPktSyncMul
48
48
}
49
- return nil , ErrPktSync
49
+
50
+ // The MariaDB server sends an error packet with sequence numer 0 during
51
+ // server shutdown. Continue to process it so the specific error can be
52
+ // detected.
53
+ if data [3 ] != 0 {
54
+ return nil , ErrPktSync
55
+ }
50
56
}
57
+
51
58
mc .sequence ++
52
59
53
60
// packets with length 0 terminate a previous packet which is a
@@ -585,6 +592,13 @@ func (mc *mysqlConn) handleErrorPacket(data []byte) error {
585
592
pos = 9
586
593
}
587
594
595
+ // If error code is for ER_CONNECTION_KILLED, then mark connection as bad.
596
+ // https://mariadb.com/kb/en/mariadb/mariadb-error-codes/
597
+ if errno == 1927 {
598
+ errLog .Print ("Error " , errno , ": " , string (data [pos :]))
599
+ return driver .ErrBadConn
600
+ }
601
+
588
602
// Error Message [string]
589
603
return & MySQLError {
590
604
Number : errno ,
You can’t perform that action at this time.
0 commit comments