Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-5478

Restart SQL Server task on "Socket closed" exception

XMLWordPrintable

    • False
    • None
    • False

      The connector task doesn't automatically restart if the "Socket closed" exception occurs in the driver. See the example stack trace below:

      org.apache.kafka.connect.errors.ConnectException: An exception occurred in the change event producer. This connector will be stopped.
      	at io.debezium.pipeline.ErrorHandler.setProducerThrowable(ErrorHandler.java:50)
      	at io.debezium.connector.sqlserver.SqlServerStreamingChangeEventSource.executeIteration(SqlServerStreamingChangeEventSource.java:313)
      	at io.debezium.connector.sqlserver.SqlServerStreamingChangeEventSource.executeIteration(SqlServerStreamingChangeEventSource.java:59)
      	at io.debezium.connector.sqlserver.SqlServerChangeEventSourceCoordinator.executeChangeEventSources(SqlServerChangeEventSourceCoordinator.java:98)
      	at io.debezium.pipeline.ChangeEventSourceCoordinator.lambda$start$0(ChangeEventSourceCoordinator.java:109)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Socket closed
      	at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:3422)
      	at com.microsoft.sqlserver.jdbc.TDSChannel.write(IOBuffer.java:2080)
      	at com.microsoft.sqlserver.jdbc.TDSWriter.flush(IOBuffer.java:4322)
      	at com.microsoft.sqlserver.jdbc.TDSWriter.writePacket(IOBuffer.java:4224)
      	at com.microsoft.sqlserver.jdbc.TDSWriter.endMessage(IOBuffer.java:3269)
      	at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:7779)
      	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:613)
      	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:537)
      	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7417)
      	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:3488)
      	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:262)
      	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:237)
      	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:456)
      	at io.debezium.jdbc.JdbcConnection.prepareQuery(JdbcConnection.java:597)
      	at io.debezium.connector.sqlserver.SqlServerConnection.getChangesForTables(SqlServerConnection.java:329)
      	at io.debezium.connector.sqlserver.SqlServerStreamingChangeEventSource.executeIteration(SqlServerStreamingChangeEventSource.java:190)
      	... 8 more
      Caused by: java.net.SocketException: Socket closed
      	at java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
      	at java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150)
      	at com.microsoft.sqlserver.jdbc.TDSChannel.write(IOBuffer.java:2075)
      	... 22 more
      

      The task should restart as it does after "Connection reset" and other network errors.

            Unassigned Unassigned
            sergeimorozov Sergei Morozov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: