Description
Start a sharded cluster of two-member replica sets and kill a primary, so one of the shards has only a secondary.
>>> c = pymongo.MongoClient()
|
>>> c.test.command('dbstats')
|
Traceback (most recent call last):
|
File "<stdin>", line 1, in <module>
|
File "/Users/emptysquare/.virtualenvs/motor/lib/python2.7/site-packages/pymongo/database.py", line 437, in command
|
uuid_subtype, compile_re, **kwargs)[0]
|
File "/Users/emptysquare/.virtualenvs/motor/lib/python2.7/site-packages/pymongo/database.py", line 343, in _command
|
msg, allowable_errors)
|
File "/Users/emptysquare/.virtualenvs/motor/lib/python2.7/site-packages/pymongo/helpers.py", line 151, in _check_command_response
|
errmsg = details["errmsg"]
|
KeyError: 'errmsg'
|
>>> c.server_info()['version']
|
u'2.4.9'
|
>>> c.server_info()['gitVersion']
|
u'52fe0d21959e32a5bdbecdc62057db386e4e029c'
|
The problem is mongos's error structure:
{
|
"raw" : {
|
"shard0/localhost:4000,localhost:4001" : {
|
|
}
|
},
|
"ok" : 0,
|
"errmsg" : "{ shard0/localhost:4000,localhost:4001: \"result without error message returned : {}\" }"
|
}
|
PyMongo expects the "raw" error from shard0 to be a full error document, but it's empty. I've tested this with 2.4.9 and 2.6.4.
PyMongo on the current 3.0-dev raises KeyError for the same reason.
Attachments
Issue Links
- is depended on by
-
DRIVERS-187 Handle empty "raw" errors from mongos
-
- Closed
-
- is related to
-
SERVER-15428 Empty "raw" error from mongos when a shard has no primary or is down
-
- Closed
-