Make sure we close the connection and don't leak it in java sources. #10128
Labels
area/connectors
Connector related issues
area/databases
autoteam
connectors/source/mssql
connectors/source/mysql
connectors/source/postgres
connectors/sources-database
team/db-dw-sources
Backlog for Database and Data Warehouse Sources team
type/bug
Something isn't working
Summary
Description
While investigating #9744, I found two phenomena:
onClose
method of the stream, which is supposed to close the connection and now it is not executed, leaving the connection open.StreamingJdbcDatabase
may have connection leak. It callsgetConnection
from the data source, and it is left for the user to close those connection. When the 1) issue happens, the connection won't get closed.Update
The issue is not from Redshift when the table is empty. It is connection leak. A Java
Stream
is not automatically closed. TheonClose
callback won't be triggered unless theStream
is manually closed. Many of theJdbcDatabase
methods return aStream
, which needs to be manually closed or put in atry
block. It is not always the case currently, resulting in connection leaks.Reference
The text was updated successfully, but these errors were encountered: