Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Mongo ChangeStreamDocument in Native Image Fails Decoding On Update #23602

Closed
luke-gee opened this issue Feb 11, 2022 · 3 comments · Fixed by #23620
Closed

Using Mongo ChangeStreamDocument in Native Image Fails Decoding On Update #23602

luke-gee opened this issue Feb 11, 2022 · 3 comments · Fixed by #23620
Labels
area/mongodb kind/bug Something isn't working
Milestone

Comments

@luke-gee
Copy link
Contributor

luke-gee commented Feb 11, 2022

Describe the bug

Using the Mongo ChangeStream fails in native mode when receiving notification of a database update with the following error:

Change Stream Subscription Error: org.bson.codecs.configuration.CodecConfigurationException: Failed to decode 'ChangeStreamDocument'. Decoding 'updateDescription' errored with: Cannot find a public
constructor for 'UpdateDescription'.
event-publishing-eventPublisher-1  |    at org.bson.codecs.pojo.PojoCodecImpl.decodePropertyModel(PojoCodecImpl.java:206)
event-publishing-eventPublisher-1  |    at org.bson.codecs.pojo.PojoCodecImpl.decodeProperties(PojoCodecImpl.java:179)
event-publishing-eventPublisher-1  |    at org.bson.codecs.pojo.PojoCodecImpl.decode(PojoCodecImpl.java:103)
event-publishing-eventPublisher-1  |    at org.bson.codecs.pojo.PojoCodecImpl.decode(PojoCodecImpl.java:107)
event-publishing-eventPublisher-1  |    at com.mongodb.client.model.changestream.ChangeStreamDocumentCodec.decode(ChangeStreamDocumentCodec.java:63)
event-publishing-eventPublisher-1  |    at com.mongodb.client.model.changestream.ChangeStreamDocumentCodec.decode(ChangeStreamDocumentCodec.java:35)
event-publishing-eventPublisher-1  |    at org.bson.RawBsonDocument.decode(RawBsonDocument.java:161)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.operation.ChangeStreamBatchCursor.convertAndProduceLastId(ChangeStreamBatchCursor.java:185)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.operation.AsyncChangeStreamBatchCursor$2.onResult(AsyncChangeStreamBatchCursor.java:201)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.operation.AsyncChangeStreamBatchCursor$2.onResult(AsyncChangeStreamBatchCursor.java:194)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.operation.AsyncQueryBatchCursor.next(AsyncQueryBatchCursor.java:163)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.operation.AsyncChangeStreamBatchCursor$1.apply(AsyncChangeStreamBatchCursor.java:83)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.operation.AsyncChangeStreamBatchCursor.resumeableOperation(AsyncChangeStreamBatchCursor.java:194)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.operation.AsyncChangeStreamBatchCursor.next(AsyncChangeStreamBatchCursor.java:79)
event-publishing-eventPublisher-1  |    at com.mongodb.reactivestreams.client.internal.BatchCursor.lambda$next$0(BatchCursor.java:35)
event-publishing-eventPublisher-1  |    at reactor.core.publisher.MonoCreate.subscribe(MonoCreate.java:57)
event-publishing-eventPublisher-1  |    at reactor.core.publisher.MonoPeek.subscribe(MonoPeek.java:67)
event-publishing-eventPublisher-1  |    at reactor.core.publisher.MonoPeek.subscribe(MonoPeek.java:67)
event-publishing-eventPublisher-1  |    at reactor.core.publisher.MonoPeekTerminal.subscribe(MonoPeekTerminal.java:61)
event-publishing-eventPublisher-1  |    at reactor.core.publisher.Mono.subscribe(Mono.java:3873)
event-publishing-eventPublisher-1  |    at reactor.core.publisher.Mono.subscribeWith(Mono.java:3979)
event-publishing-eventPublisher-1  |    at reactor.core.publisher.Mono.subscribe(Mono.java:3758)
event-publishing-eventPublisher-1  |    at com.mongodb.reactivestreams.client.internal.BatchCursorFlux.recurseCursor(BatchCursorFlux.java:104)
event-publishing-eventPublisher-1  |    at com.mongodb.reactivestreams.client.internal.BatchCursorFlux.lambda$subscribe$0(BatchCursorFlux.java:56)
event-publishing-eventPublisher-1  |    at reactor.core.publisher.LambdaMonoSubscriber.onNext(LambdaMonoSubscriber.java:137)
event-publishing-eventPublisher-1  |    at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121)
event-publishing-eventPublisher-1  |    at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1643)
event-publishing-eventPublisher-1  |    at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:241)
event-publishing-eventPublisher-1  |    at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:192)
event-publishing-eventPublisher-1  |    at reactor.core.publisher.MonoCreate$DefaultMonoSink.success(MonoCreate.java:156)
event-publishing-eventPublisher-1  |    at com.mongodb.reactivestreams.client.internal.MongoOperationPublisher.lambda$sinkToCallback$30(MongoOperationPublisher.java:549)
event-publishing-eventPublisher-1  |    at com.mongodb.reactivestreams.client.internal.OperationExecutorImpl.lambda$execute$2(OperationExecutorImpl.java:78)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.operation.ChangeStreamOperation$2$1.call(ChangeStreamOperation.java:347)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.operation.OperationHelper.withAsyncConnectionSource(OperationHelper.java:727)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.operation.OperationHelper.access$100(OperationHelper.java:69)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.operation.OperationHelper$AsyncCallableWithSourceCallback.onResult(OperationHelper.java:706)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.operation.OperationHelper$AsyncCallableWithSourceCallback.onResult(OperationHelper.java:696)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:48)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.async.client.ClientSessionBinding$WrappingCallback.onResult(ClientSessionBinding.java:267)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.async.client.ClientSessionBinding$WrappingCallback.onResult(ClientSessionBinding.java:255)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.binding.AsyncClusterBinding$1.onResult(AsyncClusterBinding.java:119)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.binding.AsyncClusterBinding$1.onResult(AsyncClusterBinding.java:113)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.connection.BaseCluster$ServerSelectionRequest.onResult(BaseCluster.java:430)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.connection.BaseCluster.handleServerSelectionRequest(BaseCluster.java:294)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.connection.BaseCluster.selectServerAsync(BaseCluster.java:155)
event-publishing-eventPublisher-1  |    at com.mongodb.internal.connection.SingleServerCluster.selectServerAsync(SingleServerCluster.java:41)

This works fine in jvm mode, suggesting some classes may need registering for reflection

Expected behavior

Expect document unmarshalled correctly.

Actual behavior

No response

How to Reproduce?

https://github.com/luke-gee/monog-changestream-reproducer

Added steps in the readme

Output of uname -a or ver

Microsoft Windows [Version 10.0.19042.1466]

Output of java -version

openjdk version "16.0.2" 2021-07-20 OpenJDK Runtime Environment GraalVM CE 21.2.0 (build 16.0.2+7-jvmci-21.2-b08) OpenJDK 64-Bit Server VM GraalVM CE 21.2.0 (build 16.0.2+7-jvmci-21.2-b08, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.7.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

mvn

Additional information

Image build in container, not using the java env above.

@luke-gee luke-gee added the kind/bug Something isn't working label Feb 11, 2022
@quarkus-bot quarkus-bot bot added area/mongodb env/windows Impacts Windows machines labels Feb 11, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 11, 2022

/cc @evanchooly, @loicmathieu

@geoand geoand removed the env/windows Impacts Windows machines label Feb 11, 2022
@luke-gee
Copy link
Contributor Author

raised a PR for the registration #23620

Working on a windows machine ive had a lot of trouble adding an integration test but have verified working in the original reproducer.

Added a zip with the class i added to expose for integration test if helpful.
ReactiveChangeStreamResource.zip

@loicmathieu
Copy link
Contributor

@luke-gee thanks a lot, I'll review your PR.
For such small change, adding an integration test is not needed.

@loicmathieu loicmathieu added this to the 2.8 - main milestone Feb 11, 2022
@gsmet gsmet modified the milestones: 2.8 - main, 2.7.2.Final Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mongodb kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants