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

InstanceAlreadyExistsException during MongoDb connector metrics registration

    XMLWordPrintable

Details

    Description

      Bug report

      For bug reports, provide this information, please:

      What Debezium connector do you use and what version?

      debezium-connector-mongodb version 1.9.0.Final

      What is the connector configuration?

      {
        "name": "test-mongodb-connector",
        "config": {
          "connector.class": "io.debezium.connector.mongodb.MongoDbConnector",
          "mongodb.hosts": "mongos.mongo-cluster:27017",
          "mongodb.name": "test_mongodb",
          "collection.include.list": "public.test_collection",
          "tasks.max": "10",
          "capture.mode": "oplog"
        }
      }
      

      What is the captured database version and mode of deployment?

      MongoDB v4.2.18, Kubernetes

      What behaviour do you expect?

      I have MongoDB connector running on single instance of Kafka Connect application. The connector is connected to shared cluster with 3 shards deployed as a replica set. All connector tasks are started successfully.

      What behaviour do you see?

      Kafka Connect starts 3 connector tasks, 2 of which fail with the error:

      java.lang.RuntimeException: Unable to register the MBean 'debezium.mongodb:type=connector-metrics,context=snapshot,server=test_mongodb'
        at io.debezium.metrics.Metrics.register(Metrics.java:77)
        at io.debezium.pipeline.ChangeEventSourceCoordinator.lambda$start$0(ChangeEventSourceCoordinator.java:101)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
      Caused by: javax.management.InstanceAlreadyExistsException: debezium.mongodb:type=connector-metrics,context=snapshot,server=test_mongodb
        at java.management/com.sun.jmx.mbeanserver.Repository.addMBean(Unknown Source)
        at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(Unknown Source)
        at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(Unknown Source)
        at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(Unknown Source)
        at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(Unknown Source)
        at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(Unknown Source)
        at io.debezium.metrics.Metrics.register(Metrics.java:73)
        ... 6 more
      

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

      Yes

      Implementation ideas (optional)

      I suggest adding MongoDB task id (value of "mongodb.task.id" connector property) to MBean name like it is done by Kafka Connect:

      kafka.connect:type=source-task-metrics,connector=([-.\w]+),task=([\d]+)
      

      Attachments

        Activity

          People

            ccranfor@redhat.com Chris Cranford
            andrey.pustovetov@gmail.com Andrey Pustovetov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: