[CDRIVER-1928] "Unknown command error" from authentication and misformatted domain socket URI Created: 17/Nov/16 Updated: 17/Dec/16 Resolved: 10/Dec/16 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libmongoc |
| Affects Version/s: | 1.5.0 |
| Fix Version/s: | 1.5.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jeremy Mikola | Assignee: | A. Jesse Jiryu Davis |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
MongoDB 3.2, libmongoc-1.5.0-rc6 |
||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
In I extracted the following trace while reproducing the scenario with MongoDB 3.2 and a build of the PHPC linked against libmongoc 1.5.0-rc6:
This translates to:
From the MongoDB logs, the following command was being executed at the time:
I consulted the legacy PHP driver and it did consult the "$err" field when checking for cursor errors (see: mongo_connect_send_packet()). Based on the trace data, _mongoc_populate_cmd_error() is being used to populate the bson_error_t. Perhaps _mongoc_populate_query_error(), which does check for "$err" and "code" fields, should be used instead. |
| Comments |
| Comment by Githook User [ 17/Dec/16 ] | |||||||||||||||
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}Message: Auth errors have $err, not the standard errmsg - check for $err instead | |||||||||||||||
| Comment by Githook User [ 10/Dec/16 ] | |||||||||||||||
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}Message: Auth errors have $err, not the standard errmsg - check for $err instead | |||||||||||||||
| Comment by Githook User [ 27/Nov/16 ] | |||||||||||||||
|
Author: {u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}Message: | |||||||||||||||
| Comment by A. Jesse Jiryu Davis [ 27/Nov/16 ] | |||||||||||||||
|
Authenticating to mongod 2.6.9 or 3.2.9 with URI "mongodb://user:pass@/tmp/mongodb.sock" gets this reply:
The function we currently use, _mongoc_populate_cmd_error, checks for "errmsg" but not for "$err". Let's just extend _mongoc_populate_cmd_error:
Let's also update the domain socket example in advanced-connections.page to show a properly escaped domain socket path.
By the way, the Manual shows the old connection string style, not escaped: mongodb:///tmp/mongodb-27017.sock https://docs.mongodb.com/manual/reference/connection-string/#unix-domain-socket I've filed | |||||||||||||||
| Comment by Hannes Magnusson [ 21/Nov/16 ] | |||||||||||||||
|
This may be causing Fatal error: Uncaught exception 'MongoDB\Driver\Exception\RuntimeException' with message 'Unknown command error' error in the PHP driver on authentication failure... Which raises the urgency of this ticket. |