[SERVER-53499] dropRole fails when requireApiVersion=1 Created: 23/Dec/20  Updated: 29/Oct/23  Resolved: 19/Jan/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.9.0

Type: Bug Priority: Major - P3
Reporter: Shane Harvey Assignee: Mark Benvenuto
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-56925 Remove requireApiVersion server param... Closed
is related to PYTHON-2453 Versioned MongoDB API for Drivers Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Security 2021-01-11, Security 2021-01-25
Participants:

 Description   

Python test suite fails while executing this dropRole command against a standalone mongod with requireApiVersion=1:

{'dropRole': 'noremove', 'apiVersion': '1'}

The error:

ERROR: test_no_remove (test.test_bulk.TestBulkAuthorization)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/shane/git/mongo-python-driver/test/test_bulk.py", line 385, in tearDown
    self.db.command('dropRole', 'noremove')
  File "/Users/shane/git/mongo-python-driver/pymongo/database.py", line 741, in command
    return self._command(sock_info, command, slave_ok, value,
  File "/Users/shane/git/mongo-python-driver/pymongo/database.py", line 629, in _command
    return sock_info.command(
  File "/Users/shane/git/mongo-python-driver/pymongo/pool.py", line 718, in command
    return command(self, dbname, spec, slave_ok,
  File "/Users/shane/git/mongo-python-driver/pymongo/network.py", line 160, in command
    helpers._check_command_response(
  File "/Users/shane/git/mongo-python-driver/pymongo/helpers.py", line 164, in _check_command_response
    raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: Failed to remove role noremove@pymongo_test from all users :: caused by :: The apiVersion parameter is required, please configure your MongoClient's API version, full error: {'ok': 0.0, 'errmsg': "Failed to remove role noremove@pymongo_test from all users :: caused by :: The apiVersion parameter is required, please configure your MongoClient's API version", 'code': 498870, 'codeName': 'Location498870'}

This error is unexpected because apiVersion was included in the dropRole command. The server version is:

v4.9.0-alpha-1082-g399f119



 Comments   
Comment by Githook User [ 15/Jan/21 ]

Author:

{'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}

Message: SERVER-53499 Handle UMC commands with requireApiVersion and standalone mongod
Branch: master
https://github.com/mongodb/mongo/commit/bc942ef3f9e7bb0c92147abe9bd680b62ee837c1

Comment by Ian Whalen (Inactive) [ 12/Jan/21 ]

Author:

{'username': u'ShaneHarvey', 'name': u'Shane Harvey', 'email': u'shane.harvey@mongodb.com'}

Message:PYTHON-2453 Add MongoDB Versioned API (#536)

Add pymongo.server_api.ServerApi and the MongoClient server_api option.
Support Unified Test Format version 1.1 (serverParameters in
runOnRequirements)
Skip dropRole tests due to SERVER-53499.
Branch:master
https://github.com/mongodb/mongo-python-driver/commit/ac2f506ba262b6360275fba96bb4fa1d43ae50f7

Comment by Ian Whalen (Inactive) [ 12/Jan/21 ]

Author:

{'username': u'ShaneHarvey', 'name': u'Shane Harvey', 'email': u'shane.harvey@mongodb.com'}

Message:PYTHON-2453 Add MongoDB Versioned API (#536)

Add pymongo.server_api.ServerApi and the MongoClient server_api option.
Support Unified Test Format version 1.1 (serverParameters in
runOnRequirements)
Skip dropRole tests due to SERVER-53499.

(cherry picked from commit ac2f506ba262b6360275fba96bb4fa1d43ae50f7)
Branch:v3.12
https://github.com/mongodb/mongo-python-driver/commit/43d246f234d2ce8d728e5b114fa403d05cec75c8

Comment by Mark Benvenuto [ 12/Jan/21 ]

Original fix only worked for replica sets and not standalone mongod

Comment by Shane Harvey [ 12/Jan/21 ]

Can we reopen this issue? I still see the same bug on 4.9.0-alpha-1216-gb366fe3 which has the commit above:

$ git describe 59678f3ae24fe03116c5b1652f6f152ead3f5966
r4.9.0-alpha-1150-g59678f3ae2
$ mongodb-macos-x86_64-enterprise-4.9.0-alpha-1216-gb366fe3/bin/mongod --version
db version v4.9.0-alpha-1216-gb366fe3
Build Info: {
    "version": "4.9.0-alpha-1216-gb366fe3",
    "gitVersion": "b366fe33ed8bf3135664e612a6e90e4cb2acffd9",
    "modules": [
        "enterprise"
    ],
    "allocator": "system",
    "environment": {
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}

Same failure:

ERROR: test_no_remove (test.test_bulk.TestBulkAuthorization)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/shane/git/mongo-python-driver/test/test_bulk.py", line 386, in tearDown
    self.db.command('dropRole', 'noremove')
  File "/Users/shane/git/mongo-python-driver/pymongo/database.py", line 747, in command
    return self._command(sock_info, command, slave_ok, value,
  File "/Users/shane/git/mongo-python-driver/pymongo/database.py", line 629, in _command
    return sock_info.command(
  File "/Users/shane/git/mongo-python-driver/pymongo/pool.py", line 724, in command
    return command(self, dbname, spec, slave_ok,
  File "/Users/shane/git/mongo-python-driver/pymongo/network.py", line 159, in command
    helpers._check_command_response(
  File "/Users/shane/git/mongo-python-driver/pymongo/helpers.py", line 164, in _check_command_response
    raise OperationFailure(errmsg, code, response, max_wire_version)
pymongo.errors.OperationFailure: Failed to remove role noremove@pymongo_test from all users :: caused by :: The apiVersion parameter is required, please configure your MongoClient's API version, full error: {'ok': 0.0, 'errmsg': "Failed to remove role noremove@pymongo_test from all users :: caused by :: The apiVersion parameter is required, please configure your MongoClient's API version", 'code': 498870, 'codeName': 'Location498870'}

Comment by Githook User [ 06/Jan/21 ]

Author:

{'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}

Message: SERVER-53499 User Management commands must set apiVersion internally
Branch: master
https://github.com/mongodb/mongo/commit/59678f3ae24fe03116c5b1652f6f152ead3f5966

Generated at Thu Feb 08 05:31:06 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.