You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Martin Krüger (Jira)" <ji...@apache.org> on 2024/09/09 09:44:00 UTC
[jira] [Created] (FLINK-36237) socket closed exception when using JdbcSource with split configuration
Martin Krüger created FLINK-36237:
-------------------------------------
Summary: socket closed exception when using JdbcSource with split configuration
Key: FLINK-36237
URL: https://issues.apache.org/jira/browse/FLINK-36237
Project: Flink
Issue Type: Bug
Components: Connectors / JDBC
Affects Versions: jdbc-3.3.0
Reporter: Martin Krüger
When using the JdbcSource with a split configuration and a SimpleJdbcConnectionProvider (default), I sometimes get a socket closed exception. This is because the created connection is a shared resource hold in the SimpleJdbcConnection Provider.
The connection is requested here: [https://github.com/apache/flink-connector-jdbc/blob/1fcb9dd43a496778ee9e717657fcccdd116078cd/flink-connector-jdbc-core/src/main/java/org/apache/flink/connector/jdbc/core/datastream/source/reader/JdbcSourceSplitReader.java#L272]
Now, if the SplitReader is closed by the SplitFetcher: [https://github.com/apache/flink/blob/be25a140f011e6ff93a23f28b3826d376a1c0ba7/flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/source/reader/fetcher/SplitFetcher.java#L151]
this also closes the connection. But if the connection was already requested by the next split, the connection to use is closed which results in the socket closed exception.
My workaround was to set a connection provider which always return a fresh connection.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)