[R2DBC-76] Wrong MEDIUM binary decoding Created: 2022-12-25  Updated: 2023-03-16  Resolved: 2023-01-05

Status: Closed
Project: MariaDB Connector/R2DBC
Component/s: protocol
Affects Version/s: 1.1.2, 1.1.3
Fix Version/s: 1.1.4

Type: Bug Priority: Major
Reporter: Sridhar Iyer Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 0.5d
Original Estimate: Not Specified

Attachments: Text File error.txt     Text File error_trace.txt    

 Description   

When I try to save any entity it works fine and the entity gets saved to the database. When the entity is retrieved using ReactiveCrudRepository it throws MappingException with the latest version of r2dbc-mariadb.
This works fine with older version of the r2dbc-mariadb jar.

Logs attached.

_mariadb version 10.10
Affected versions r2dbc-mariadb 1.1.2, 1.1.3.
It works fine with the r2dbc version 1.0.3_



 Comments   
Comment by Diego Dupin [ 2023-01-04 ]

There seems to be some decoding position error. I've not been able to reproduced the issue for now.
Have you the possibility to have a wireshark log for that exchange or enable log level of "org.mariadb.r2dbc" to trace ?

Comment by Diego Dupin [ 2023-01-04 ]

In case logs cannot be enable, query and table(s) DDL would help, because LocalDate decoder is accurate, so i wonder if that can be a wrong position due to previous value wrong decoding

Comment by Sridhar Iyer [ 2023-01-04 ]

Thanks Deigo. I have attached the trace log (error_trace.txt).

Comment by Diego Dupin [ 2023-01-05 ]

ok, thanks for logs, that has permit to identify the issue.

problem is after reading a MEDIUM value driver leave a resultset pointer in a bad shape : MEDIUM are encoded on 3 bytes server side, but protocol send them in 4 bytes in exchange when using binary protocol.
This remaining byte is actually not read, making other reads on same row completly wrong.

this is corrected with https://github.com/mariadb-corporation/mariadb-connector-r2dbc/commit/08b3e06011c7274fe5a6325e5a15e12cf1f38c0f
correction is available using SNAPSHOT on maven :

<repositories>
    <repository>
        <id>sonatype-nexus-snapshots</id>
        <name>Sonatype Nexus Snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
</repositories>
 
<dependencies>
    <dependency>
        <groupId>org.mariadb</groupId>
        <artifactId>r2dbc-mariadb</artifactId>
        <version>1.1.4-SNAPSHOT</version>
    </dependency>
</dependencies>

Generated at Thu Feb 08 03:32:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.