Hi
I have a connector that connects to mongo replicaset with readPreference=secondary.
One of the secondary mongo was killed and the connector fails with error:
[2021-03-25 10:08:24,148] INFO Server 10.180.34.125:27017 is no longer a member of the replica set. Removing from client view of cluster. (org.mongodb.driver.cluster:71) [2021-03-25 10:08:24,148] INFO Setting max set version to 36 from replica set primary mongodb1:27017 (org.mongodb.driver.cluster:71) [2021-03-25 10:08:24,176] INFO Closed connection [connectionId{localValue:54, serverValue:278213}] to 10.180.34.125:27017 because the pool has been closed. (org.mongodb.driver.connection:71) [2021-03-25 10:08:24,176] INFO Closed connection [connectionId{localValue:54, serverValue:278213}] to 10.180.34.125:27017 because the pool has been closed. (org.mongodb.driver.connection:71) [2021-03-25 10:08:24,176] ERROR WorkerSourceTask{id=mongo-source-ed-main-0} Task threw an uncaught and unrecoverable exception (org.apache.kafka.connect.runtime.WorkerTask:186) java.lang.IllegalStateException: state should be: open at com.mongodb.assertions.Assertions.isTrue(Assertions.java:72) at com.mongodb.internal.connection.DefaultServer.getConnection(DefaultServer.java:90) at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.getConnection(ClusterBinding.java:133) at com.mongodb.client.internal.ClientSessionBinding$SessionBindingConnectionSource.getConnection(ClientSessionBinding.java:135) at com.mongodb.operation.QueryBatchCursor.killCursor(QueryBatchCursor.java:322) at com.mongodb.operation.QueryBatchCursor.close(QueryBatchCursor.java:185) at com.mongodb.operation.ChangeStreamBatchCursor.close(ChangeStreamBatchCursor.java:97) at com.mongodb.client.internal.MongoChangeStreamCursorImpl.close(MongoChangeStreamCursorImpl.java:53) at com.mongodb.kafka.connect.source.MongoSourceTask.getNextDocument(MongoSourceTask.java:588) at com.mongodb.kafka.connect.source.MongoSourceTask.poll(MongoSourceTask.java:203) at org.apache.kafka.connect.runtime.WorkerSourceTask.poll(WorkerSourceTask.java:272) at org.apache.kafka.connect.runtime.WorkerSourceTask.execute(WorkerSourceTask.java:239) at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:184) at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:234) 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:834) [2021-03-25 10:08:24,176] ERROR WorkerSourceTask{id=mongo-source-ed-main-0} Task is being killed and will not recover until manually restarted (org.apache.kafka.connect.runtime.WorkerTask:187) [2021-03-25 10:08:24,177] INFO Stopping MongoDB source task (com.mongodb.kafka.connect.source.MongoSourceTask:329)
As I understand exception happened because the task tried to close a cursor that already has been closed.
This happened on the 1.3.0 version, but I see that this part of the code in the master wasn't changed since 1.3.0.
- related to
-
JAVA-4289 Change stream cursors should be resilient to replicaset changes
- Closed