Skip to content

Conversation

@aclark4life
Copy link
Collaborator

@aclark4life aclark4life commented Jun 27, 2025

Previous attempts and additional context here:

@aclark4life

This comment was marked as resolved.

@timgraham

This comment was marked as resolved.

@aclark4life

This comment was marked as resolved.

@timgraham

This comment was marked as resolved.

@aclark4life

This comment was marked as resolved.

@aclark4life

This comment was marked as resolved.

@aclark4life

This comment was marked as resolved.

@aclark4life

This comment was marked as resolved.

@timgraham

This comment was marked as resolved.

@aclark4life

This comment was marked as resolved.

@aclark4life

This comment was marked as resolved.

@aclark4life

This comment was marked as resolved.

@timgraham

This comment was marked as resolved.

@aclark4life

This comment was marked as resolved.

@timgraham

This comment was marked as resolved.

@aclark4life

This comment was marked as resolved.

@timgraham timgraham force-pushed the INTPYTHON-527 branch 2 times, most recently from 7cfe63c to 74feef6 Compare November 5, 2025 14:40
@timgraham timgraham force-pushed the INTPYTHON-527 branch 2 times, most recently from ec1fe5c to cb555b5 Compare November 5, 2025 16:25
.. admonition:: Dynamic library path configuration

You may also need to configure an environment variable so that your system
can locate the library:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we be clear about the fact that this is a bug workaround and not expected behavior?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it should say something like, "If you encounter Pymongocrypt.errors.MongoCryptError: An existing crypt_shared library is loaded by the application at [/path/to/mongo_crypt_v1.so], but the current call to mongocrypt_init() failed to find that same library.", ....

Did you find the root cause so we can at least a link to that issue in a comment here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the root cause is that the error message is confusing and I don't think setting environment variables is a bug workaround … rather, it's quite common when the shared library is not in the location the OS checks by default. In these cases, my guess is that the failure to find the library is because it's not found, not that there is a 2nd conflicting library, so I think the pymongocrypt error message could be improved to help with this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how all the parts fit together, but as far as I tested, the error doesn't happen with MongoDB 7.0 so it seems plausible it could be a server regression.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timgraham Can you reproduce with 7?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problems seems specific with version 8.0.x and later of the shared library.

No issue with MongoDB 7.0.25 + mongo_crypt_shared_v1-linux-x86_64-enterprise-ubuntu2204-7.0.25 (I'm the ubuntu2204 shared library on Ubuntu 24.04 because one isn't available for 2404).

With MongoDB 7.0.25 and 8.0.15 and mongo_crypt_shared_v1-linux-x86_64-enterprise-ubuntu2404-8.0.15: "An existing crypt_shared library is loaded... " error. [fixed by specifying LD_LIBRARY_PATH]

With MongoDB 8.0.15 + mongo_crypt_shared_v1-linux-x86_64-enterprise-ubuntu2204-7.0.25, the application starts and runs, failing later (as expected) because of backward incompatible changes to queries: "csfle "analyze_query" failed: Enumeration value 'range' for field 'create.encryptedFields.fields.queryType' is not a valid value."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With MongoDB 8.0.15 + mongo_crypt_shared_v1-linux-x86_64-enterprise-ubuntu2204-7.0.25, the application starts and runs, failing later (as expected) because of backward incompatible changes to queries: "csfle "analyze_query" failed: Enumeration value 'range' for field 'create.encryptedFields.fields.queryType' is not a valid value."

Ah OK so the server should catch the missing LD_LIBRARY_PATH and say "An existing crypt_shared library is loaded... " rather than proceeding as if the library was found. Additionally the error appears nonsensical since range is correct for 8.0.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I believe the shared library 7 loads fine, even with server 8. The error message is because shared library 7 incompatible with server 8 because shared library 7 assumes it's used with server 7 and has enumeration values like "rangePreview" built-in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants