vertx-sql-client: DB2 - sending back 500: java.lang.IllegalStateException: Found unknown codepoint: 0x1153 / 4435

Context

This is a copy of https://github.com/quarkusio/quarkus/issues/14268.

Describe the bug

While I am trying to fetch a record from a DB2 Table using a reactive datasource, I am getting the following exception. The exception doesn’t tell me much what is causing the issue. However a similar code on the same codebase when used to query on a PostgreSQL Table using a Postgres reactive datasource, it is working fine.

2021-01-12 17:50:52,656 ERROR [org.jbo.res.res.i18n] (vert.x-eventloop-thread-14) RESTEASY002020: Unhandled asynchronous exception, sending back 500: java.lang.IllegalStateException: Found unknown codepoint: 0x1153 / 4435 at io.vertx.db2client.impl.drda.DRDAResponse.throwUnknownCodepoint(DRDAResponse.java:847) at io.vertx.db2client.impl.drda.DRDAConnectResponse.parseVALNSPRM(DRDAConnectResponse.java:220) at io.vertx.db2client.impl.drda.DRDAConnectResponse.parseCommonError(DRDAConnectResponse.java:118) at io.vertx.db2client.impl.drda.DRDAConnectResponse.parseSECCHKreply(DRDAConnectResponse.java:1047) at io.vertx.db2client.impl.drda.DRDAConnectResponse.readSecurityCheck(DRDAConnectResponse.java:50) at io.vertx.db2client.impl.codec.InitialHandshakeCommandCodec.decodePayload(InitialHandshakeCommandCodec.java:102) at io.vertx.db2client.impl.codec.DB2Decoder.decodePayload(DB2Decoder.java:80) at io.vertx.db2client.impl.codec.DB2Decoder.decode(DB2Decoder.java:53) at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:834)

Expected behavior

The exception doesn’t tell me much about the issue that is causing it to fail. A similar code when run on the PostgreSQL Table there is no issue. Ideally the behavior for both PostgreSQL and DB2 driver should be consistent.

Actual behavior

A similar code when I am running using a PostgreSQL reactive datasource I m not facing any issue. So the expectation is the behavior should be same for DB2 Datasource as well.

To Reproduce

I cannot share the actual codebase as its against my employer’s policy, so I m providing a sample code in Kotlin that is using the DB2Pool. A similar code is working with PgPool.

import io.vertx.mutiny.db2client.DB2Pool
...
class SampleRepo {
    companion object {
        private val table = "table_name"
        private val schema = "schema_name"

        fun find(db2Pool: DB2Pool, str: String): Uni<SampleDO?> {
            val SELECT_ONE = "SELECT * FROM ${schema}.${table} WHERE str=$str"
            return db2Pool.preparedQuery(SELECT_ONE)
                .execute()
                .onItem().transform { it.iterator() }
                .onItem().transform { rowIterator ->
                    if (rowIterator.hasNext())
                        return@transform rowMap2SampleDO(rowIterator.next())
                    else null
                }
        }

        private fun rowMap2SampleDO(row: Row): SampleDO {
            return SampleDO(
                row.getString("xxx1"),
                row.getInteger("xxx2"),
                row.getInteger("xxx3"),
                row.getString("xxx4"))
       }
   }
}

Configuration

quarkus.datasource.reactive=true

quarkus.datasource.pg.db-kind=postgresql
quarkus.datasource.pg.username=xxx
quarkus.datasource.pg.password=xxx
quarkus.datasource.pg.reactive.url=postgresql://xxx

quarkus.datasource.db2.db-kind=db2
quarkus.datasource.db2.username=xxx
quarkus.datasource.db2.password=xxx
quarkus.datasource.db2.reactive.url=vertx-reactive:db2://xxx

Environment:

Output of uname -a or ver: Darwin xxx 19.6.0 Darwin Kernel Version 19.6.0: Tue Nov 10 00:10:30 PST 2020; root:xnu-6153.141.10~1/RELEASE_X86_64 x86_64 Output of java -version: I m using Kotlin 1.3.72

 ~$ java -version
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
GraalVM version (if different from Java): NA
Quarkus version or git rev: 1.10.2.Final

Build tool (ie. output of mvnw --version or gradlew --version):

~$ mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /xxx/xxx/xxx/maven/3.6.3_1/libexec
Java version: 11.0.2, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"

Let me know if you need any additional details. I can provide the same here.

Note: Some of the information that cannot be shared here, has been masked as xxx.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (11 by maintainers)

Most upvoted comments

Actually it looks like I was wrong, this isn’t an issue with the statement, but with authentication: at io.vertx.db2client.impl.drda.DRDAConnectResponse.parseSECCHKreply(DRDAConnectResponse.java:1047) at io.vertx.db2client.impl.drda.DRDAConnectResponse.readSecurityCheck(DRDAConnectResponse.java:50)

I’ll do some poking around to see if I can recreate this, but it may not be easy to recreate.