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

When Debezium executes `select *` in the snapshot phase, it does not catch the sql exception, resulting in confusing exceptions and logs

    XMLWordPrintable

Details

    Description

      Debezium will throws this exception:

       

      Reporting error:
      org.apache.kafka.connect.errors.ConnectException: Streaming result set com.mysql.cj.protocol.a.result.ResultsetRowsStreaming@37181575 is still active. No statements may be issued when any streaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming result sets before attempting more queries. Error code: 0; SQLSTATE: S1000.
      at io.debezium.connector.mysql.AbstractReader.wrap(AbstractReader.java:241)
      at io.debezium.connector.mysql.AbstractReader.failed(AbstractReader.java:218)
      at io.debezium.connector.mysql.SnapshotReader.execute(SnapshotReader.java:857)
      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:748)
      Caused by: java.sql.SQLException: Streaming result set com.mysql.cj.protocol.a.result.ResultsetRowsStreaming@37181575 is still active. No statements may be issued when any streaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming result sets before attempting more queries.
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
      at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
      at com.mysql.cj.jdbc.ConnectionImpl.commit(ConnectionImpl.java:814)
      at io.debezium.connector.mysql.SnapshotReader.execute(SnapshotReader.java:773)
      ... 3 common frames omitted

       

      But in fact, this anomaly is not the root cause. It is because there is no catch sql exception in the following locations:

       

      This is actually similar to a code like this:

       

      In the end, only one irrelevant exception was printed, and the most critical exception was ignored. (In my code, illegalargument exception is the root cause, but it actually prints nullpointerexception)

      Attachments

        Activity

          People

            Unassigned Unassigned
            carryxyh 时无两丶 c (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: