[MONGOCRYPT-167] Increase mongocrypt_status_set max message length Created: 09/Aug/19  Updated: 28/Oct/23  Resolved: 16/Oct/19

Status: Closed
Project: Libmongocrypt
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Shane Harvey Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: fle-ga
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to PYTHON-1925 Add libmongocrypt cypto hooks Closed

 Description   

The following python code prints 1023 instead of 10024.

    msg = b"X"*10024
    lib.mongocrypt_status_set(
        status, lib.MONGOCRYPT_STATUS_ERROR_CLIENT, 1, msg, -1)
    msg2 = _to_string(lib.mongocrypt_status_message(status, ffi.NULL))
    print(len(msg2))

It appears that mongocrypt_status_set truncates the message to 1023 bytes. I propose we document this limitation or increase the max message size.

My use case is that I want to save a python stack trace as the message. Later I want to be able to retrieve and display the full trace. 1023 is too small for a lot of failures, especially when they happen in a deeply nested function.



 Comments   
Comment by Githook User [ 16/Oct/19 ]

Author:

{'name': 'Kevin Albertson', 'username': 'kevinAlbs', 'email': 'kevin.albertson@mongodb.com'}

Message: MONGOCRYPT-167 remove character limit of status message

Also covers MONGOCRYPT-26: document weirdness of extra +1 for string length.
Branch: master
https://github.com/mongodb/libmongocrypt/commit/1bf29a30ced85e903070a7e9d7c1de018546cac5

Comment by Shane Harvey [ 14/Oct/19 ]

Ideally mongocrypt_status_message could accept any length string but if the length needs to have a hard coded limit I think 8192 or even 4096 would be more reasonable than 1024.

Generated at Thu Feb 08 09:08:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.