java.sql.SQLException: Operation not allowed after ResultSet closed

754 views
Skip to first unread message

Vikash Bhattar

unread,
Mar 25, 2019, 4:12:47 PM3/25/19
to vert.x
I'm using queryStreamWithParams method to get stream of records from a table.

connection -> connection.queryStreamWithParams(query, params, streamAR -> {
                if (streamAR.failed()) {
                    closeConnectionL(connection);

                    errorHandler.handle(streamAR.cause());
                    return;
                }

                SQLRowStream rowStream = streamAR.result();

                rowStream.endHandler(streamEnd -> {
                    closeConnection(connection);

                    if (endHandler != null) {
                        endHandler.handle(null);
                    }
                }).exceptionHandler(ex -> {
                    closeConnection(connection);

                    errorHandler.handle(ex);
                });





Here's the stack trace:

java.sql.SQLException: Operation not allowed after ResultSet closed
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964) ~[mysql-connector-java-5.1.44.jar:5.1.44]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:897) ~[mysql-connector-java-5.1.44.jar:5.1.44]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:886) ~[mysql-connector-java-5.1.44.jar:5.1.44]
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860) ~[mysql-connector-java-5.1.44.jar:5.1.44]
        at com.mysql.jdbc.ResultSetImpl.checkClosed(ResultSetImpl.java:743) ~[mysql-connector-java-5.1.44.jar:5.1.44]
        at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:6285) ~[mysql-connector-java-5.1.44.jar:5.1.44]
        at io.vertx.ext.jdbc.impl.actions.JDBCSQLRowStream.readRows(JDBCSQLRowStream.java:207) ~[vertx-jdbc-client-3.5.4.1.jar:3.5.4.1]
        at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:273) ~[vertx-core-3.5.4.jar:3.5.4]
        at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76) ~[vertx-core-3.5.4.jar:3.5.4]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.32.Final.jar:4.1.32.Final]
        at java.lang.Thread.run(Thread.java:834) [?:?]


I'm not able to figure pout what could the reason behind this exception. Please help.

Julien Viet

unread,
Mar 26, 2019, 3:52:17 AM3/26/19
to vert.x
Hi,

it seems that the query stream is trying to read rows from a closed connection.

have you tried with a more recent version of Vert.x ?

Julien

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/3ce25b81-8e83-4d30-9635-57f6f5e01a8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vikash Bhattar

unread,
Mar 26, 2019, 4:20:22 AM3/26/19
to vert.x
Hi Julien,

<vertx.version>3.5.4</vertx.version>

Could it be because there are no connections available? Or all vertx worker pool threads are busy while executing executeBlocking?

Julien Viet

unread,
Mar 26, 2019, 6:42:40 PM3/26/19
to vert.x
it would be interesting to understand why the connection is closed in the first place.

can you try using a more recent version ?

Reply all
Reply to author
Forward
0 new messages