The sink is MySQL. After running in STREAMING mode for a period of time, it throws the error "No operations allowed after statement closed". How can I resolve this issue?
- Dominant language
- Java
- Stars
- 9.7k
- Forks
- 2.4k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 204
Description
### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22) and found no similar issues.
### What happened
In MySQL‑CDC mode with MySQL as the sink in STREAMING mode, this error occurs after running for a period of time. It is presumed that the connection becomes invalid, yet Seatunnel still tries to use this connection without mechanisms such as connection liveness detection.
### SeaTunnel Version
2.3.12
### SeaTunnel Config
```conf
sink {
jdbc {
url = "jdbc:mysql://localhost:3306/a?useSSL=false&serverTimezone=Asia/Shanghai"
driver = "com.mysql.cj.jdbc.Driver"
user = "xx"
password = "xx"
max_retries = 5
table = "${table_name}"
generate_sink_sql = true
connection_check_timeout_sec = 1800
properties {
connection-test-query = "select 1"
validation-timeout = 3000
max-lifetime = 600000
leak-detection-threshold = 60000
}
database = a
primary_keys = ["${primary_key}"]
}
}
```
### Running Command
```shell
./seatunnel.sh --config ../config/a.conf
```
### Error Exception
```log
Caused by: java.sql.SQLException:No operations allowed after statement closed
```
### Zeta or Flink or Spark Version
_No response_
### Java or Scala Version
_No response_
### Screenshots
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
Contributor guide
No contributing guide indexed for this repository
Research direction
No source file or test is named in the report. Start by reproducing the MySQL-CDC to MySQL streaming job with the supplied JDBC sink configuration and inspect how connection_check_timeout_sec and the connection properties are handled. Done means the job continues running without the "No operations allowed after statement closed" error after a connection becomes invalid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, mysql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100