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

Debezium Server: Nats consumer crashes with binary serialization

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.1.0.Beta1
    • None
    • debezium-server
    • None

      In order to make your issue reports as actionable as possible, please provide the following information, depending on the issue type.

      Bug report

      For bug reports, provide this information, please:

      What Debezium connector do you use and what version?

      Debezium Server version 3.0.0 with a Nats Jetstream sink

      What is the connector configuration?

      • DEBEZIUM_SINK_TYPE=nats-jetstream
      • DEBEZIUM_SINK_NATS_JETSTREAM_URL=nats://nats:4222
      • DEBEZIUM_SINK_NATS_JETSTREAM_CREATE_STREAM=true
      • DEBEZIUM_SINK_NATS_JETSTREAM_STREAM=DebeziumStream
      • DEBEZIUM_SINK_NATS_JETSTREAM_SUBJECTS=dbz,dbz.>
      • DEBEZIUM_SOURCE_CONNECTOR_CLASS=io.debezium.connector.postgresql.PostgresConnector
      • DEBEZIUM_SOURCE_OFFSET_STORAGE_FILE_FILENAME=data/offsets.dat
      • DEBEZIUM_SOURCE_OFFSET_FLUSH_INTERVAL_MS=0
      • DEBEZIUM_SOURCE_DATABASE_HOSTNAME=postgres
      • DEBEZIUM_SOURCE_DATABASE_PORT=5432
      • DEBEZIUM_SOURCE_DATABASE_USER=postgres
      • DEBEZIUM_SOURCE_DATABASE_PASSWORD=postgres
      • DEBEZIUM_SOURCE_DATABASE_DBNAME=postgres
      • DEBEZIUM_SOURCE_PLUGIN_NAME=pgoutput
      • DEBEZIUM_SOURCE_TOPIC_PREFIX=dbz
      • DEBEZIUM_SOURCE_SCHEMA_INCLUDE_LIST=public
      • DEBEZIUM_FORMAT_VALUE=avro
      • DEBEZIUM_FORMAT_VALUE_APICURIO_REGISTRY_URL=http://apicurio:8080/apis/registry/v2
      • DEBEZIUM_FORMAT_VALUE_APICURIO_REGISTRY_AUTO-REGISTER=true
      • DEBEZIUM_FORMAT_VALUE_APICURIO_REGISTRY_FIND-LATEST=true
      • ENABLE_APICURIO_CONVERTERS=true

        What is the captured database version and mode of deployment?

      (E.g. on-premises, with a specific cloud provider, etc.)

      Postgres, on prem with docker

      What behavior do you expect?

      When using binary serialization (e.g. avro) with the nats consumer, it should publish the messages in binary format successfully.

      What behavior do you see?

      It crashes when trying to process any event. Per the log, there is a bad logging statement that tries to force the record value to a string or throws. 

      I've submitted this PR to fix the logging statement.

      Do you see the same behaviour using the latest released Debezium version?

      (Ideally, also verify with latest Alpha/Beta/CR version)

      yes

      Do you have the connector logs, ideally from start till finish?

      (You might be asked later to provide DEBUG/TRACE level log)

      {"timestamp":"2025-02-11T18:30:51.99Z","sequence":227,"loggerClassName":"org.slf4j.impl.Slf4jLogger","loggerName":"io.debezium.server.ConnectorLifecycle","level":"ERROR","message":"Connector completed: success = 'false', message = 'io.debezium.DebeziumException: Unexpected data type '[B'', error = 'io.debezium.DebeziumException: Unexpected data type '[B''","threadName":"pool-7-thread-1","threadId":26,"mdc":{},"ndc":"","hostName":"debezium","processName":"io.debezium.server.Main","processId":1,"exception":{"refId":1,"exceptionType":"io.debezium.DebeziumException","message":"Unexpected data type '[B'","frames":[

      {"class":"io.debezium.server.BaseChangeConsumer","method":"getString","line":84}

      ,{"class":"io.debezium.server.nats.jetstream.NatsJetStreamChangeConsumer","method":"handleBatch","line":184},{"class":"io.debezium.embedded.async.ParallelSmtAndConvertBatchProcessor","method":"processRecords","line":56},{"class":"io.debezium.embedded.async.AsyncEmbeddedEngine$PollRecords","method":"doCall","line":1167},{"class":"io.debezium.embedded.async.AsyncEmbeddedEngine$PollRecords","method":"doCall","line":1148},{"class":"io.debezium.embedded.async.RetryingCallable","method":"call","line":47},{"class":"java.util.concurrent.FutureTask","method":"run","line":264},{"class":"java.util.concurrent.Executors$RunnableAdapter","method":"call","line":515},{"class":"java.util.concurrent.FutureTask","method":"run","line":264},{"class":"java.util.concurrent.ThreadPoolExecutor","method":"runWorker","line":1128},{"class":"java.util.concurrent.ThreadPoolExecutor$Worker","method":"run","line":628},{"class":"java.lang.Thread","method":"run","line":829}]}}

      How to reproduce the issue using our tutorial deployment?

      I am able to reproduce it using this minimal docker compose configuration

      services:
        postgres:
          image: postgres:latest
          container_name: postgres
          environment:
            POSTGRES_USER: postgres
            POSTGRES_PASSWORD: postgres
            POSTGRES_DB: postgres
          command:
            - "postgres"
            - "-c"
            - "wal_level=logical"
          ports:
            - "5432:5432"
          networks:
            - debezium-net
          volumes:
            - pgdata:/var/lib/postgresql/data
      
        debezium:
          image: debezium/server:3.0.0.Final
          container_name: debezium-server
          environment:
            - DEBEZIUM_SINK_TYPE=nats-jetstream
            - DEBEZIUM_SINK_NATS_JETSTREAM_URL=nats://nats:4222
            - DEBEZIUM_SINK_NATS_JETSTREAM_CREATE_STREAM=true
            - DEBEZIUM_SINK_NATS_JETSTREAM_STREAM=DebeziumStream
            - DEBEZIUM_SINK_NATS_JETSTREAM_SUBJECTS=dbz,dbz.>
            - DEBEZIUM_SOURCE_CONNECTOR_CLASS=io.debezium.connector.postgresql.PostgresConnector
            - DEBEZIUM_SOURCE_OFFSET_STORAGE_FILE_FILENAME=data/offsets.dat
            - DEBEZIUM_SOURCE_OFFSET_FLUSH_INTERVAL_MS=0
            - DEBEZIUM_SOURCE_DATABASE_HOSTNAME=postgres
            - DEBEZIUM_SOURCE_DATABASE_PORT=5432
            - DEBEZIUM_SOURCE_DATABASE_USER=postgres
            - DEBEZIUM_SOURCE_DATABASE_PASSWORD=postgres
            - DEBEZIUM_SOURCE_DATABASE_DBNAME=postgres
            - DEBEZIUM_SOURCE_PLUGIN_NAME=pgoutput
            - DEBEZIUM_SOURCE_TOPIC_PREFIX=dbz
            - DEBEZIUM_SOURCE_SCHEMA_INCLUDE_LIST=public
            - DEBEZIUM_FORMAT_VALUE=avro
            - DEBEZIUM_FORMAT_VALUE_APICURIO_REGISTRY_URL=http://apicurio:8080/apis/registry/v2
            - DEBEZIUM_FORMAT_VALUE_APICURIO_REGISTRY_AUTO-REGISTER=true
            - DEBEZIUM_FORMAT_VALUE_APICURIO_REGISTRY_FIND-LATEST=true
            - ENABLE_APICURIO_CONVERTERS=true
          ports:
            - "8083:8083"
          depends_on:
            - postgres
            - nats
          networks:
            - debezium-net
        
        apicurio-registry:
          container_name: apicurio
          networks:
            - debezium-net
          image: apicurio/apicurio-registry-mem:latest-release
          ports:
            - "8080:8080"
      
        nats:
          image: nats:latest
          container_name: nats
          ports:
            - "4222:4222"
          networks:
            - debezium-net
          command: --js -sd /data
      
      networks:
        debezium-net:
          driver: bridge
      
      volumes:
        pgdata: 

       

      Feature request or enhancement

      For feature requests or enhancements, provide this information, please:

      Which use case/requirement will be addressed by the proposed feature?

      <Your answer>

      Implementation ideas (optional)

      <Your answer>

              Unassigned Unassigned
              mcambria-red Michael Cambria
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: