Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with Db2 reactive client when accessing a remote Db2 instance #14117

Closed
andreasbukalski opened this issue Jan 5, 2021 · 10 comments
Closed
Labels
area/reactive-sql-clients kind/bug Something isn't working triage/needs-feedback We are waiting for feedback.

Comments

@andreasbukalski
Copy link

andreasbukalski commented Jan 5, 2021

Describe the bug
It looks like the reactive access to Db2 is aborting with problems in the security/encryption area.
However, the remote Db2 instance does not use encryption. No specific Db2 libraries are used either (see POM excerpt).

Access via JDBC works without problems. The metadata provides information about which Db2 version is used.

Expected behavior
Timestamp information is printed

Actual behavior
JDBC Access:
curl -H"Accept: text/plain" localhost:80/dbaccess/jdbc
[db name = DB2/AIX64
, db version = SQL110122
, driver name = IBM Data Server Driver for JDBC and SQLJ
, driver version = 4.27.25]

Reactive Access:
ERROR [org.jbo.res.res.i18n] (vert.x-eventloop-thread-14) RESTEASY002020: Unhandled asynchronous exception, sending back 500: java.lang.IllegalStateException: Found invalid codepoint: 1909
at io.vertx.db2client.impl.drda.DRDAConnectResponse.parseACCSECRD(DRDAConnectResponse.java:1441)
at io.vertx.db2client.impl.drda.DRDAConnectResponse.parseACCSECreply(DRDAConnectResponse.java:1169)
at io.vertx.db2client.impl.drda.DRDAConnectResponse.readAccessSecurity(DRDAConnectResponse.java:35)
at io.vertx.db2client.impl.codec.InitialHandshakeCommandCodec.decodePayload(InitialHandshakeCommandCodec.java:96)
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)

ERROR [io.qua.ver.cor.run.VertxCoreRecorder] (vert.x-eventloop-thread-14) Uncaught exception received by Vert.x: java.lang.IllegalStateException: Result is already complete: failed
at io.vertx.core.impl.FutureImpl.fail(FutureImpl.java:126)
at io.vertx.sqlclient.impl.ConnectionPool.lambda$check$0(ConnectionPool.java:216)
at io.vertx.sqlclient.impl.command.CommandBase.fail(CommandBase.java:31)
at io.vertx.db2client.impl.codec.InitialHandshakeCommandCodec.lambda$encode$0(InitialHandshakeCommandCodec.java:55)
at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:366)
at io.vertx.core.impl.EventLoopContext.lambda$executeAsync$0(EventLoopContext.java:38)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
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)

To Reproduce

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.List;
import io.smallrye.mutiny.Multi;

@path("/dbaccess")
public class Db2AccessResource {
@Inject
JDBCService jdbcService;

@Inject
ReactiveService reactiveService;

//curl -H"Accept: text/plain" localhost:8080/dbaccess/jdbc
@GET
@Path("/jdbc")
@Produces(MediaType.TEXT_PLAIN)
public List<String> readDb2() {
    return jdbcService.readDb2();
}

//curl -H"Accept: application/json" localhost:8080/dbaccess/reactive
@GET
@Path("/reactive")
@Produces(MediaType.TEXT_PLAIN)
public Multi<String> handleReactive() {
    return reactiveService.readDb2();
}

}

import io.agroal.api.AgroalDataSource;
import io.quarkus.agroal.DataSource;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List;
import java.sql.*;

@ApplicationScoped
public class JDBCService {

@Inject
AgroalDataSource ds;

List<String> readDb2() {
    String query = "SELECT CURRENT TIMESTAMP FROM sysibm.sysdummy1";
    ArrayList<String> resp = new ArrayList<>();
    try(Connection con = ds.getConnection();
        PreparedStatement stmt = con.prepareStatement(query)) {

        DatabaseMetaData md = con.getMetaData();

        resp.add("db name = " + md.getDatabaseProductName() + System.lineSeparator());
        resp.add("db version = " + md.getDatabaseProductVersion() + System.lineSeparator());
        resp.add("driver name = " + md.getDriverName() + System.lineSeparator());
        resp.add("driver version = " + md.getDriverVersion());

    } catch(Exception e) {
        System.out.println(e.getMessage());
    }
    return resp;
}

}

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import io.vertx.mutiny.db2client.DB2Pool;
import io.vertx.mutiny.sqlclient.Row;
import io.vertx.mutiny.sqlclient.Tuple;

import io.smallrye.mutiny.Multi;

@ApplicationScoped
public class ReactiveService {

@Inject
DB2Pool db2Pool;

Multi<String> readDb2() {
    String query = "SELECT CURRENT TIMESTAMP FROM sysibm.sysdummy1";
    return db2Pool.preparedQuery(query)
            .execute()
            .onItem().produceMulti(set -> Multi.createFrom().iterable(set))
            .onItem().apply(row -> from(row));
}

private static String from(Row row) {
    String ret = String.format("%s ", row.getString(0));
    return ret;
}

}

Steps to reproduce the behavior:

  1. run Quarkus
  2. call curl -H"Accept: text/plain" localhost:8080/dbaccess/jdbc
  3. call curl -H"Accept: application/json" localhost:8080/dbaccess/reactive

Configuration
!!Server name and port number are anonymised!!

quarkus.datasource.db-kind=db2
quarkus.datasource.jdbc.driver=com.ibm.db2.jcc.DB2Driver
quarkus.datasource.jdbc.url=jdbc:db2://servername:prtnum/dbname

quarkus.datasource.username=***
quarkus.datasource.password=***

quarkus.datasource.reactive.url=vertx-reactive:db2://servername:prtnum/dbname

POM

<compiler-plugin.version>3.8.1</compiler-plugin.version>
<maven.compiler.parameters>true</maven.compiler.parameters>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus-plugin.version>1.10.5.Final</quarkus-plugin.version>
<quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>1.10.5.Final</quarkus.platform.version>
<surefire-plugin.version>2.22.1</surefire-plugin.version>




${quarkus.platform.group-id}
${quarkus.platform.artifact-id}
${quarkus.platform.version}
pom
import





io.quarkus
quarkus-resteasy-jsonb


io.quarkus
quarkus-resteasy


io.quarkus
quarkus-agroal


io.quarkus
quarkus-arc


io.quarkus
quarkus-junit5
test


io.rest-assured
rest-assured
test


io.quarkus
quarkus-jdbc-db2


io.quarkus
quarkus-reactive-db2-client


io.quarkus
quarkus-resteasy-mutiny

Environment (please complete the following information):

  • Output of uname -a or ver:
    Darwin MAC2412HTDD 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020;

  • Output of java -version:
    openjdk 11.0.6 2020-01-14
    OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
    OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.6+10, mixed mode)

  • GraalVM version (if different from Java):
    not used in the sample

  • Quarkus version or git rev:
    1.10.5.Final

  • Build tool (ie. output of mvnw --version or gradlew --version):
    maven 3.6.3, Intellij 2020.3
    Additional context
    (Add any other context about the problem here.)

@andreasbukalski andreasbukalski added the kind/bug Something isn't working label Jan 5, 2021
@ghost ghost added the area/persistence OBSOLETE, DO NOT USE label Jan 5, 2021
@ghost
Copy link

ghost commented Jan 5, 2021

/cc @aguibert

@Sanne
Copy link
Member

Sanne commented Apr 14, 2021

@mswatosh could you have a look please?

@patajones
Copy link

the same here

@mswatosh
Copy link
Contributor

I haven't been able to reproduce this locally (Though I see that CodePoint 1909 is missing). We're hitting this when running through Access Security, so is there any sort of security beyond basic user/password set on the DB2 server instance?

@RajaManeshKumar
Copy link

Thank you very much i resolve my issue.

@phelioz
Copy link

phelioz commented Oct 13, 2021

@RajaManeshKumar How did you resolve it?
Have the same problem, works well with the JDBC driver but with the reactive driver I get Found invalide codepoint 1909.

@aguibert talked about in a other issue about codepoint 1909 carries info about the encryption algorithm being used and how there is no encrypting implemented in the reactive db2 driver.
Is this still the case? if so is there any plans for implementing encryption in the reactive db2 driver?

@codeinwind
Copy link

@RajaManeshKumar
I got the similar issue even with the most recent 2.16.2.Final version of quarkus, would you please elaborate your solution last time?

@aguibert Hi Andrew, do you have any insight on this?

Request failed: java.lang.IllegalStateException: Expected code point 14ac but was fffffffe
at io.vertx.db2client.impl.drda.DRDAResponse.parseLengthAndMatchCodePoint(DRDAResponse.java:1135)
at io.vertx.db2client.impl.drda.DRDAConnectResponse.parseACCSECRD(DRDAConnectResponse.java:1401)
at io.vertx.db2client.impl.drda.DRDAConnectResponse.parseACCSECreply(DRDAConnectResponse.java:1176)
at io.vertx.db2client.impl.drda.DRDAConnectResponse.readAccessSecurity(DRDAConnectResponse.java:35)
at io.vertx.db2client.impl.codec.InitialHandshakeCommandCodec.decodePayload(InitialHandshakeCommandCodec.java:101)
at io.vertx.db2client.impl.codec.DB2Decoder.decodePayload(DB2Decoder.java:79)
at io.vertx.db2client.impl.codec.DB2Decoder.decode(DB2Decoder.java:52)

@argenstijn
Copy link

Same here!.

Request failed: java.lang.IllegalStateException: Expected code point 14ac but was fffffffe

using quarkus 3.3.2, java 17 and db2 as database.

@geoand
Copy link
Contributor

geoand commented Sep 20, 2024

Is this still an issue with the latest versions of Quarkus?

@geoand geoand added the triage/needs-feedback We are waiting for feedback. label Sep 20, 2024
@geoand
Copy link
Contributor

geoand commented Oct 2, 2024

Closing for lack of feedback

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/reactive-sql-clients kind/bug Something isn't working triage/needs-feedback We are waiting for feedback.
Projects
None yet
Development

No branches or pull requests

10 participants