Uploaded image for project: 'Quarkus'
  1. Quarkus
  2. QUARKUS-1997

Reactive Oracle client fails session propagation test

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Critical Critical
    • None
    • 2.7.5.ER2
    • team/eng
    • Hide
      git clone git@github.com:jsmrcka/quarkus-test-suite.git
      cd ./quarkus-test-suite
      git checkout QUARKUS-1407-hibernate-reactive
      

      Failure on Oracle:

      mvn clean verify -pl sql-db/hibernate-reactive -Dinclude.tests=OracleDatabaseIT
      

      Pass on another DB:

      mvn clean verify -pl sql-db/hibernate-reactive -Dinclude.tests=Postgresql13DatabaseIT
      
      Show
      git clone git@github.com:jsmrcka/quarkus-test-suite.git cd ./quarkus-test-suite git checkout QUARKUS-1407-hibernate-reactive Failure on Oracle: mvn clean verify -pl sql-db/hibernate-reactive -Dinclude.tests=OracleDatabaseIT Pass on another DB: mvn clean verify -pl sql-db/hibernate-reactive -Dinclude.tests=Postgresql13DatabaseIT
    • +
    • ---

      GH issue: https://github.com/quarkusio/quarkus/issues/24501

      In our test suite, we run a test:

          @Test
          @Order(4)
          public void ensureSessionIsPropagatedOnReactiveTransactions() {
              getApp().given()
                      .contentType(ContentType.JSON)
                      .post("hibernate/books/pablo/suntzu")
                      .then()
                      .body(is(""))
                      .statusCode(HttpStatus.SC_CREATED);
          }
      

      (https://github.com/jsmrcka/quarkus-test-suite/blob/6a659826bd8fd4c7dfdc21d398d063fdb32527f3/sql-db/hibernate-reactive/src/test/java/io/quarkus/ts/reactive/AbstractReactiveDatabaseIT.java#L66)

      which calls an endpoint:

      @Path("/hibernate")
      @Produces(MediaType.APPLICATION_JSON)
      @Consumes(MediaType.APPLICATION_JSON)
      public class GroundedEndpoint {
      
          Mutiny.SessionFactory factory;
      
          ...
      
          @POST
          @Path("books/{authorName}/{name}")
          public Uni<Response> createBook(String authorName, String name) {
              return factory.withTransaction((session, transaction) -> {
                  Author author = new Author();
                  author.setName(authorName);
                  return session.persist(author)
                          .map(nothing -> session.getReference(author).getId())
                          .map(authorId -> {
                              Book book = new Book();
                              book.setAuthor(authorId);
                              book.setTitle(name);
                              return book;
                          })
                          .flatMap(session::persist);
              })
                      .map(nothing -> Response.status(Response.Status.CREATED))
                      .onFailure().recoverWithItem(error -> Response.status(Response.Status.BAD_REQUEST).entity(error.getMessage()))
                      .map(Response.ResponseBuilder::build);
          }
      }
      

      (https://github.com/jsmrcka/quarkus-test-suite/blob/6a659826bd8fd4c7dfdc21d398d063fdb32527f3/sql-db/hibernate-reactive/src/main/java/io/quarkus/ts/reactive/http/GroundedEndpoint.java#L83)

      The module (see reproducer) is configured to run against various DBs using reactive clients (quarkus-reactive-oracle-client, quarkus-reactive-pg-client, ...) and Hibernate Reactive (quarkus-hibernate-reactive, quarkus-hibernate-reactive-panache).

      It fails on aforementioned test using Oracle, while it passes for other DBs.

      There is some sort of isolation issue, because the failure only occurs in the specific setup shown in the reproducer branch. The test must be run in combination with other tests in the scenario and in a specific order. When executed in isolation, the test passes.

      I tried several 2.7.* versions, the reproducer fails with all of them: 2.7.5.Final, 2.7.3.Final, 2.7.0.Final.

      Test fails using Oracle DB with following error:

      [ERROR] Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 78.008 s <<< FAILURE! - in io.quarkus.ts.reactive.OracleDatabaseIT
      [ERROR] ensureSessionIsPropagatedOnReactiveTransactions  Time elapsed: 1.107 s  <<< FAILURE!
      java.lang.AssertionError: 
      1 expectation failed.
      Response body doesn't match expectation.
      Expected: is ""
        Actual: Multiple exceptions caught:
      	[Exception 0] io.vertx.core.VertxException: Error : 1453, Position : 0, Sql = SET TRANSACTION ISOLATION LEVEL READ COMMITTED, OriginalSql = SET TRANSACTION ISOLATION LEVEL READ COMMITTED, Error Msg = ORA-01453: SET TRANSACTION must be first statement of transaction
      
      	[Exception 1] java.lang.NullPointerException
      
      	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
      	at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:72)
      	at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:59)
      	at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:263)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:277)
      	at io.restassured.internal.ResponseSpecificationImpl$HamcrestAssertionClosure.validate(ResponseSpecificationImpl.groovy:493)
      	at io.restassured.internal.ResponseSpecificationImpl$HamcrestAssertionClosure$validate$1.call(Unknown Source)
      	at io.restassured.internal.ResponseSpecificationImpl.validateResponseIfRequired(ResponseSpecificationImpl.groovy:674)
              ...
      

            Unassigned Unassigned
            rhn-support-jsmrcka Josef Smrcka (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: