vapor / mysql-nio

🐬 Non-blocking, event-driven Swift client for MySQL.
MIT License
87 stars 28 forks source link

Protocol error with older database #8

Closed pkese closed 3 years ago

pkese commented 4 years ago

I have an older/stable [1] MySQL database.

let rows : [MySQLRow] = try conn.simpleQuery("SELECT @@version").wait()

...returns empty result.

There's also an output on the screen saying:
Fatal error: unhandled packet: ByteBuffer { readerIndex: 0, writerIndex: 16, readableBytes: 16, capacity: 16, slice: _ByteBufferSlice { 53..<69 }, storage: 0x00007fce8002c260 (512 bytes) } readable bytes (max 1k): [ 0f 35 2e 36 2e 32 35 2d 37 33 2e 31 2d 6c 6f 67 ]

Decoding [ 0f 35 2e 36 2e 32 35 2d 37 33 2e 31 2d 6c 6f 67 ] as ASCII gives 5.6.25-73.1-log
so apparently database is producing the result, but Vapor is failing to deserialize it.

I assume there's probably a protocol mismatch.

[1] MySQL 5.6 is indeed a bit older, but it it still officially supported. Latest release was about a month ago

pkese commented 4 years ago

...same request as above succeeds when connected to a more modern database (10.2.10-MariaDB)

bendodson commented 3 years ago

I had a similar problem with MySQL 5.6 but upgrading to 5.7 was enough to resolve my issues.

tanner0101 commented 3 years ago

This package only tests against 5.7+ (see https://github.com/vapor/mysql-nio/blob/master/.github/workflows/test.yml). 5.7 changed the wire protocol quite a bit so supporting 5.6 and earlier is quite a hassle. The previous version of this package (located at https://github.com/vapor/mysql-kit/releases/3.0.0) supports down to 5.5. That version will only be receiving bug fixes going forward though.

oprisk commented 1 year ago

I'm having the same issue, the server crashes after 12 hours and must be restarted. Obvious that MySql connectivity for version 8 is not production ready as well. The issue is not Fluent nor Vapor, but MySQL interface. I think the question was closed without resolution which is puzzling. How can the community adopt this technology if the interfaces are not production ready?

@tanner0101 3 years later the same issue remains now with MySql 8. Can we reopen the issue, I'm willing to help with debugging the issue, thanks