sdkman / sdkman-broker

Download broker service for SDKMAN!
Apache License 2.0
0 stars 7 forks source link

MongoQueryException when using latest mongo image #22

Open willpewitt opened 1 year ago

willpewitt commented 1 year ago

When pulling the latest mongo image the following exception occurs when trying to run any query

com.mongodb.MongoQueryException: Query failed with error code 352 and error message 'Unsupported OP_QUERY command: find. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal' on server localhost:27017
    at com.mongodb.operation.FindOperation$1.call(FindOperation.java:492)
    at com.mongodb.operation.FindOperation$1.call(FindOperation.java:482)
    at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:239)
    at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:212)
    at com.mongodb.operation.FindOperation.execute(FindOperation.java:482)
    at com.mongodb.operation.FindOperation.execute(FindOperation.java:79)
    at com.mongodb.Mongo.execute(Mongo.java:772)
    at com.mongodb.Mongo$2.execute(Mongo.java:759)
    at com.mongodb.FindIterableImpl$FindOperationIterable.first(FindIterableImpl.java:207)
    at com.mongodb.FindIterableImpl.first(FindIterableImpl.java:148)
    at io.sdkman.broker.app.AppRepo.findVersion$lambda$3(AppRepo.kt:35)
    at ratpack.exec.Blocking$1.lambda$get$0(Blocking.java:69)
    at ratpack.exec.internal.DefaultExecution.intercept(DefaultExecution.java:236)
    at ratpack.exec.Blocking$1.get(Blocking.java:67)
    at ratpack.exec.Blocking$1.get(Blocking.java:60)
    at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at ratpack.exec.internal.DefaultExecController$ExecControllerBindingThreadFactory.lambda$newThread$0(DefaultExecController.java:137)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:829)

I suspect the issue is that is due to the client being quite old. 3.2.2 was released in Feb 15 2016. If the version of Mongo used in production was known we could upgrade the client to a newer verison

It appears that the breakage starts when using a version older than 3.6.0

marc0der commented 1 year ago

Hi @willpewitt, the Mongo client is bound to our current (old) version of Mongo running in prod. Upgrading would need to be a phased approach. The beauty of Docker is that you can just keep on using the mongo:3.2 image.