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

Provide more user friendly error messages based on MongoDB error codes and context of use. [DATAMONGO-1876] #2778

Open
spring-projects-issues opened this issue Feb 14, 2018 · 3 comments

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Feb 14, 2018

Christoph Strobl opened DATAMONGO-1876 and commented

Error codes and messages provided by MongoDB server do not alway provide enough information for uses to be able to solve problems themselfes. Eg. featureCompatibility errors can cause confusion.

Investigate if we can provide more detailed errors based on the MongoDB error codes and the context of use of a feature


Reference URL: https://github.com/mongodb/mongo/blob/master/src/mongo/base/error_codes.err

Issue Links:

  • DATAMONGO-1875 UncategorizedMongoDbException: $jsonSchema is not allowed in this context

  • DATAMONGO-2212 No error logged or thrown using change stream and incompatible featureCompatibilityVersion
    ("is superseded by")

Referenced from: commits c56263d

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Feb 21, 2019

JeremyTwiggs commented

I've just recently had an issue I feel is related to this.

Trying to use MongoDB change streams. I had it working against a local replica set, but as soon as I deployed to our testing environment, I got nothing, no errors, no info, just silence.

After switching on DEBUG logging of org.mongodb this immediately helped me solve the issue:

2019-02-21 15:00:38.392 DEBUG [poc-mongo-changestream-listener,,,] 20087 --- [       Thread-8] org.mongodb.driver.protocol.command      : Sending command '{ "aggregate" : "transaction", "pipeline" : [{ "$changeStream" : { "fullDocument" : "updateLookup" } }, { "$match" : { "operationType" : { "$in" : ["insert", "update"] } } }], "cursor" : { "batchSize" : 2147483647 }, "$db" : "mld_permissions", "$readPreference" : { "mode" : "primaryPreferred" } }' with request id 15 to database mld_permissions on connection [connectionId{localValue:3, serverValue:1338}] to server localhost:270172019-02-21 15:00:38.392 DEBUG [poc-mongo-changestream-listener,,,] 20087 --- [       Thread-8] org.mongodb.driver.protocol.command      : Sending command '{ "aggregate" : "transaction", "pipeline" : [{ "$changeStream" : { "fullDocument" : "updateLookup" } }, { "$match" : { "operationType" : { "$in" : ["insert", "update"] } } }], "cursor" : { "batchSize" : 2147483647 }, "$db" : "mld_permissions", "$readPreference" : { "mode" : "primaryPreferred" } }' with request id 15 to database mld_permissions on connection [connectionId{localValue:3, serverValue:1338}] to server localhost:270172019-02-21 15:00:38.396 DEBUG [poc-mongo-changestream-listener,,,] 20087 --- [       Thread-7] org.mongodb.driver.protocol.command      : Execution of command with request id 15 failed to complete successfully in 3.69 ms on connection [connectionId{localValue:3, serverValue:1338}] to server localhost:27017
com.mongodb.MongoCommandException: Command failed with error 72 (InvalidOptions): 'The featureCompatibilityVersion must be 3.6 to use the $changeStream stage. See http://dochub.mongodb.org/core/3.6-feature-compatibility.' on server localhost:27017. The full response is { "ok" : 0.0, "errmsg" : "The featureCompatibilityVersion must be 3.6 to use the $changeStream stage. See http://dochub.mongodb.org/core/3.6-feature-compatibility.", "code" : 72, "codeName" : "InvalidOptions" } at com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:179) at com.mongodb.internal.connection.InternalStreamConnection$2$1.onResult(InternalStreamConnection.java:370) at com.mongodb.internal.connection.InternalStreamConnection$2$1.onResult(InternalStreamConnection.java:356) 

My issue was that this MongoDB, although version 3.6.6 was at featureCompatibilityVersion 3.4.

Setting it to 3.6 fixed the issue.

I feel that this should have been logged at WARNING at the very least.

 

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Feb 21, 2019

Mark Paluch commented

JeremyTwiggs Can you please file another issue regarding errors during change streams usage? Using no ErrorHandler should log exceptions on ERROR level.

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Feb 26, 2019

JeremyTwiggs commented

Hi Mark Paluch thanks for the message,

I have raised DATAMONGO-2212. Hope this contains all the info required. Let me know if more is needed.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants