[CDRIVER-3969] Destruction of cursor leads to failed bson assert of the cursor server_id Created: 29/Apr/21 Updated: 28/Oct/23 Resolved: 26/Jun/23 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libmongoc |
| Affects Version/s: | 1.16.1, 1.17.5 |
| Fix Version/s: | 1.24.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Johannes Schulte | Assignee: | Kevin Albertson |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | rp-toSched, size-small | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows 10 with mongoc driver 1.75.5 |
||
| Attachments: |
|
| Quarter: | FY23Q3, FY24Q2 |
| Description |
|
I encountered an issue where the mongoc_cursor_destroy function is not able to destroy a cursor. I attached a file with a small c program that demonstrates the issue. You need to replace the uri_string, db_name & collection_name so they are valid for your system. The issue only occurs when the collection has more than 100 elements. The crucial part in the attached c program is the following:
The cursor returned from mongoc_cursor_new_from_command_reply_with_opts has a non zero cursor_id and a server_id which is zero. This leads to the failure of BSON_ASSERT(server_id) during the destruction of the cursor inside mongoc_cluster_stream_for_server() in mongoc-cluster.c. The log output is the following:
|
| Comments |
| Comment by Githook User [ 11/Jul/23 ] |
|
Author: {'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}Message: serverId is expected in mongoc_cursor_new_from_command_reply_with_opts |
| Comment by Githook User [ 03/Jul/23 ] |
|
Author: {'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}Message: serverId is expected in mongoc_cursor_new_from_command_reply_with_opts |
| Comment by Githook User [ 26/Jun/23 ] |
|
Author: {'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}Message:
If an error occurs, `found` is false. Assert on the error first to print the error.
|
| Comment by Githook User [ 26/Jun/23 ] |
|
Author: {'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}Message:
If an error occurs, `found` is false. Assert on the error first to print the error.
|
| Comment by Kevin Albertson [ 29/Apr/21 ] |
|
Hi johannes.schulte@inmation.com, thank you for the bug report and the reproducible program. I was able to reproduce this against a 4.4 MongoDB server, and agree this is a valid bug. |