[Bug] [SQL task] no operation allowed after statement closed
Search before asking
- [X] I had searched in the issues and found no similar issues.
What happened
When I use Apache DolphinScheduler 3.2.2 to schedule Apache Doris 2.1.5/2.1.6 SQL tasks, the error "no operation allowed after statement closed" frequently occurs. However, this error does not occur when I use Apache Doris 2.1.2. Here are the error logs.
Caused by: com.mysql.cj.exceptions.StatementIsClosedException: No operations allowed after statement closed. at sun.reflect.GeneratedConstructorAccessor85.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:52) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:76) at com.mysql.cj.jdbc.StatementImpl.checkClosed(StatementImpl.java:352) at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:933) ... 17 common frames omitted [ERROR] 2024-10-11 10:23:42.739 +0800 - Task execute failed, due to meet an exception org.apache.dolphinscheduler.plugin.task.sql.api.SqlTaskExecutionException: SQL task failed at org.apache.dolphinscheduler.plugin.task.sql.sqlTask.handleTask(SqlTask.java:166) at org.apache.dolphinscheduler.server.worker.runner.DefaultWorkerTaskExecutor.executeTask(DefaultWorkerTaskExecutor.java:51) at org.apache.dolphinscheduler.server.worker.runner.WorkerTaskExecuteThread.run(WorkerTaskExecutor.java:172) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750) Caused by: java.sql.SQLException: No operations allowed after statement closed. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:53) at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:933) at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1045) at org.apache.dolphinscheduler.plugin.task.sql.SqlTask.handleTask(SqlTask.java:327) at org.apache.dolphinscheduler.plugin.task.sql.SqlTask.execute(SqlTask.java:208) at org.apache.dolphinscheduler.plugin.task.api.AbstractTask.dispense(AbstractTask.java:159) ... 17 common frames omitted Caused by: com.mysql.cj.exceptions.StatementIsClosedException: No operations allowed after statement closed. at sun.reflect.GeneratedConstructorAccessor85.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:52) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:76) at com.mysql.cj.jdbc.StatementImpl.checkClosed(StatementImpl.java:352) at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:933) ... 17 common frames omitted
The following is the SQL I executed. I tried using both the Doris data source and the MySQL data source, but I couldn't avoid this error.
**SELECT MAX(time) AS max_time FROM mytable;**
What you expected to happen
I think this error is because the database connection timed out or disconnected during the operation, causing the Statement object to be unavailable. However, I tried adding parameters like autoReconnect and wait_timeout to the database connection, but it didn't work. I saw a similar issue in druid, and here's the link: druid issues 5262
How to reproduce
You can reproduce the issue using doris2.1.6 and dolphinscheduler 3.2.2.
Anything else
No response
Version
3.2.x
Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
This issue has been automatically marked as stale because it has not had recent activity for 30 days. It will be closed in next 7 days if no further activity occurs.
This issue has been closed because it has not received response for too long time. You could reopen it if you encountered similar problems in the future.