question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

issue with r2dbc when first column is empty string

See original GitHub issue

I am using the latest version of spring-boot, spring-data-r2dbc and jasync sql

@GetMapping("/teste")
    fun teste(): Flux<Map<String, Any>> {
        return db.execute("select '' as x,'1' as y ").fetch().all()
    }
2019-10-23 17:31:24.667 ERROR 5845 --- [-netty-thread-1] c.g.jasync.sql.db.mysql.MySQLConnection  : <mysql-connection-1> Transport failure 

java.lang.IndexOutOfBoundsException: readerIndex(3) + length(2) exceeds writerIndex(3): UnpooledSlicedByteBuf(ridx: 3, widx: 3, cap: 3/3, unwrapped: UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeNoCleanerDirectByteBuf(ridx: 75, widx: 84, cap: 512))
	at io.netty.buffer.AbstractByteBuf.checkReadableBytes0(AbstractByteBuf.java:1495) ~[netty-buffer-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.buffer.AbstractByteBuf.readShort(AbstractByteBuf.java:764) ~[netty-buffer-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.buffer.SwappedByteBuf.readShort(SwappedByteBuf.java:546) ~[netty-buffer-4.1.42.Final.jar:4.1.42.Final]
	at com.github.jasync.sql.db.mysql.decoder.OkDecoder.decode(OkDecoder.kt:17) ~[jasync-mysql-1.0.9.jar:na]
	at com.github.jasync.sql.db.mysql.codec.MySQLFrameDecoder.doDecoding(MySQLFrameDecoder.kt:184) ~[jasync-mysql-1.0.9.jar:na]
	at com.github.jasync.sql.db.mysql.codec.MySQLFrameDecoder.handleCommonFlow(MySQLFrameDecoder.kt:169) ~[jasync-mysql-1.0.9.jar:na]
	at com.github.jasync.sql.db.mysql.codec.MySQLFrameDecoder.decode(MySQLFrameDecoder.kt:97) ~[jasync-mysql-1.0.9.jar:na]
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:505) ~[netty-codec-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:444) ~[netty-codec-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:283) ~[netty-codec-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [netty-transport-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1422) [netty-transport-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-transport-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-transport-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:931) [netty-transport-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [netty-transport-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:700) [netty-transport-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:635) [netty-transport-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:552) [netty-transport-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514) [netty-transport-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044) [netty-common-4.1.42.Final.jar:4.1.42.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.42.Final.jar:4.1.42.Final]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_191]

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    id("org.springframework.boot") version "2.2.0.RELEASE"
    id("io.spring.dependency-management") version "1.0.8.RELEASE"
    kotlin("jvm") version "1.3.50"
    kotlin("plugin.spring") version "1.3.50"
}

group = "com.cz"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_1_8

val developmentOnly by configurations.creating
configurations {
    runtimeClasspath {
        extendsFrom(developmentOnly)
    }
    compileOnly {
        extendsFrom(configurations.annotationProcessor.get())
    }
}

repositories {
    mavenCentral()
    maven { url = uri("https://repo.spring.io/milestone") }
}

dependencies {
    implementation("org.springframework.boot.experimental:spring-boot-actuator-autoconfigure-r2dbc")
    implementation("org.springframework.boot:spring-boot-starter-actuator")
    implementation("org.springframework.boot.experimental:spring-boot-starter-data-r2dbc")
    implementation("org.springframework.boot:spring-boot-starter-webflux")
    implementation("com.github.jasync-sql:jasync-r2dbc-mysql:1.0.9")
//    {
//        exclude(group="io.projectreactor.netty")
//    }
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
    implementation("io.micrometer:micrometer-registry-prometheus")
    implementation("org.jetbrains.kotlin:kotlin-reflect")
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
    developmentOnly("org.springframework.boot:spring-boot-devtools")
    annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
    testImplementation("org.springframework.boot:spring-boot-starter-test") {
        exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
    }
    testImplementation("org.springframework.boot.experimental:spring-boot-test-autoconfigure-r2dbc")
    testImplementation("io.projectreactor:reactor-test")
}

dependencyManagement {
    imports {
        mavenBom("org.springframework.boot.experimental:spring-boot-bom-r2dbc:0.1.0.M2")
    }
}

tasks.withType<Test> {
    useJUnitPlatform()
}

tasks.withType<KotlinCompile> {
    kotlinOptions {
        freeCompilerArgs = listOf("-Xjsr305=strict")
        jvmTarget = "1.8"
    }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
andy-yx-chencommented, Oct 26, 2019

@oshai sounds very similar to #121

0reactions
oshaicommented, Oct 29, 2019

Fix is released in 1.0.10

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Boot R2DBC inner Join returns null in some fields
I managed to solve it by adding @org.springframework.data.relational.core.mapping.Column annotations to the Java model class column names.
Read more >
R2DBC/r2dbc - Gitter
I'm facing an issue with r2dbc-pool and r2dbc postgresql. ... Postgres always returns one data row per one CopyData message, and that is...
Read more >
Spring Data R2DBC - Reference Documentation
If a query result violates the defined constraint, an exception is thrown. This happens when the method would return null but is declared...
Read more >
Reactive programming with Spring Data R2DBC - Medium
In the application we built, we only used one type of domain object. Therefore, all operations dealing with the data access layer were ......
Read more >
Micronaut Data - GitHub Pages
Repositories with JPA Criteria API specification for Micronaut JDBC/R2DBC ... private String password; @Column(columnDefinition = "date") @Convert(converter ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found