[CDRIVER-1969] Driver aborts after "mongoc_cluster_run_command_internal(): precondition failed: command_name" Created: 29/Dec/16 Updated: 17/Jan/17 Resolved: 17/Jan/17 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libmongoc |
| Affects Version/s: | None |
| Fix Version/s: | 1.6.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Arseny Vakhrushev | Assignee: | A. Jesse Jiryu Davis |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
To illustrate the case, it is sufficient to pass an empty BSON as a command to mongoc_client_command_simple():
When something is appended to the command, the issue is gone. See the example below:
|
| Comments |
| Comment by Githook User [ 16/Jan/17 ] |
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}Message: |
| Comment by Hannes Magnusson [ 30/Dec/16 ] |
|
Fair enough. I was just curious how this was discover to decide on how critical issue this is. |
| Comment by Arseny Vakhrushev [ 29/Dec/16 ] |
|
By "every internal assertion" I don't mean the requirements of the API itself of course. In particular, there is no documented requirement for the command argument to contain certain fields except that it should be a valid bson_t. Hence, I don't believe I am breaking the contract. |
| Comment by Arseny Vakhrushev [ 29/Dec/16 ] |
|
The actual use is out of question I assume. When you write a high-level binding and just expose the method to the user, trust me, there will be one who will run it with something that will cause a crash. And in this case, it's either you who controls the arguments (which I of course do for my part) or the authors of the underlying API. Obviously as the author of a binding, I do not want to be immersed into internals of the underlying API too much. Because otherwise, it would be pure hell to obey with every internal assertion. |
| Comment by Hannes Magnusson [ 29/Dec/16 ] |
|
Just out of curiosity, Is there an actual usecase to run empty command? This assertion is an internal check to make sure we ship something to the server that looks like a real command, I suppose the abort is a bit harsh and we should return an error instead. I don't think we should send the empty bson to the server. |
| Comment by Arseny Vakhrushev [ 29/Dec/16 ] |
|
libmongoc 1.5.0 |