Uploaded image for project: 'Agroal'
  1. Agroal
  2. AG-33

Calling close does not seem to close a connection

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 0.3
    • 0.2
    • pool
    • None
    • Hide

      Use the config:

          return new JsonObject()
            .put("jdbcUrl", "jdbc:hsqldb:mem:test?shutdown=true")
            .put("driverClassName", "org.hsqldb.jdbcDriver")
            .put("minSize", 1)
            .put("maxSize", 30);
      

      Full source here:

      https://github.com/vert-x3/vertx-jdbc-client

      Show
      Use the config: return new JsonObject() .put( "jdbcUrl" , "jdbc:hsqldb:mem:test?shutdown= true " ) .put( "driverClassName" , "org.hsqldb.jdbcDriver" ) .put( "minSize" , 1) .put( "maxSize" , 30); Full source here: https://github.com/vert-x3/vertx-jdbc-client

      In vert.x we have the test:

        @Test
        public void testStreamOnClosedConnection() {
          String sql = "SELECT ID, FNAME, LNAME FROM select_table ORDER BY ID";
          final AtomicInteger cnt = new AtomicInteger(0);
          final SQLConnection conn = connection();
      
          conn.queryStream(sql, onSuccess(res -> {
            conn.close();
      
            res.resultSetClosedHandler(v -> {
              fail("Should not happen");
            }).handler(row -> {
              fail("Should not happen");
            }).endHandler(v -> {
              fail("Should not happen");
            }).exceptionHandler(t -> {
              testComplete();
            });
          }));
      
          await();
        }
      

      Now once the query is run we call conn.close() and all remaining handlers show fail except the exception handler, however the test fails and I do get the data from the result set.

      This is quite strange since it works for other pools C3P0, Hikari, BoneCP.

              lbarreiro-1 Luis Barreiro
              plopes@redhat.com Paulo Lopes (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: