[SERVER-12133] Running auth upgrade step gives cryptic error and dumps stack if version doc and actual schema are out of sync Created: 16/Dec/13  Updated: 11/Jul/16  Resolved: 07/Feb/14

Status: Closed
Project: Core Server
Component/s: Security, Usability
Affects Version/s: 2.5.4
Fix Version/s: 2.6.0-rc0

Type: Bug Priority: Major - P3
Reporter: sam.helman@10gen.com Assignee: Spencer Brody (Inactive)
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File reset_version_doc_and_upgrade.js    
Issue Links:
Related
Operating System: ALL
Participants:

 Description   

To reproduce:

  • Start a 2.6 mongod
  • Add a user with __system privileges
  • Manually reset the admin.system.version doc so that currentVersion == 1
  • Run the auth schema upgrade step

The shell gives the cryptic error

{ "ok" : 0, "errmsg" : "wrong type for field (0) 3 != 2", "code" : 13111 }

And mongod dumps stack:

 m27000| 2013-12-16T16:49:53.778-0500 [conn1] Assertion: 13111:wrong type for field (0) 3 != 2
 m27000| 2013-12-16T16:49:53.783-0500 [conn1] 0x100658a2b 0x100612f22 0x10060382f 0x10060390d 0x100591fa0 0x1000a9204 0x100040653 0x100033523 0x1000331f7 0x1000bd7b9 0x1000aad5b 0x10019fcd0 0x1001c4de5 0x1001c5b67 0x1001c67cc 0x10032c89e 0x10032d35c 0x1002b0886 0x100006e84 0x100620161
 m27000|  0   mongod                              0x0000000100658a2b _ZN5mongo15printStackTraceERSo + 43
 m27000|  1   mongod                              0x0000000100612f22 _ZN5mongo10logContextEPKc + 114
 m27000|  2   mongod                              0x000000010060382f _ZN5mongo11msgassertedEiPKc + 255
 m27000|  3   mongod                              0x000000010060390d _ZN5mongo11msgassertedEiRKSs + 29
 m27000|  4   mongod                              0x0000000100591fa0 _ZNK5mongo11BSONElement3chkEi + 800
 m27000|  5   mongod                              0x00000001000a9204 _ZN5mongo12_GLOBAL__N_118upgradeProcessUserEPNS_25AuthzManagerExternalStateERKNS_10StringDataERKNS_7BSONObjES8_ + 4164
 m27000|  6   mongod                              0x0000000100040653 _ZN5mongo20DBClientFunConvertorclERNS_27DBClientCursorBatchIteratorE + 231
 m27000|  7   mongod                              0x0000000100033523 _ZN5mongo12DBClientBase5queryEN5boost8functionIFvRNS_27DBClientCursorBatchIteratorEEEERKSsNS_5QueryEPKNS_7BSONObjEi + 249
 m27000|  8   mongod                              0x00000001000331f7 _ZN5mongo12DBClientBase5queryEN5boost8functionIFvRKNS_7BSONObjEEEERKSsNS_5QueryEPS4_i + 397
 m27000|  9   mongod                              0x00000001000bd7b9 _ZN5mongo31AuthzManagerExternalStateMongod5queryERKNS_15NamespaceStringERKNS_7BSONObjES6_RKN5boost8functionIFvS6_EEE + 347
 m27000|  10  mongod                              0x00000001000aad5b _ZN5mongo20AuthorizationManager17upgradeSchemaStepERKNS_7BSONObjEPb + 3035
 m27000|  11  mongod                              0x000000010019fcd0 _ZN5mongo24CmdAuthSchemaUpgradeStep3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 290
 m27000|  12  mongod                              0x00000001001c4de5 _ZN5mongo12_execCommandEPNS_7CommandERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 37
 m27000|  13  mongod                              0x00000001001c5b67 _ZN5mongo7Command11execCommandEPS0_RNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb + 1865
 m27000|  14  mongod                              0x00000001001c67cc _ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 1388
 m27000|  15  mongod                              0x000000010032c89e _ZN5mongo11runCommandsEPKcRNS_7BSONObjERNS_5CurOpERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 46
 m27000|  16  mongod                              0x000000010032d35c _ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 2204
 m27000|  17  mongod                              0x00000001002b0886 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 1958
 m27000|  18  mongod                              0x0000000100006e84 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 308
 m27000|  19  mongod                              0x0000000100620161 _ZN5mongo17PortMessageServer17handleIncomingMsgEPv + 1681
 m27000| 2013-12-16T16:49:53.783-0500 [conn1] Auth schema upgraded failed with Unknown error code wrong type for field (0) 3 != 2

Attached is a minimal reproducing case.



 Comments   
Comment by Githook User [ 07/Feb/14 ]

Author:

{u'username': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@mongodb.com'}

Message: SERVER-12133 Improve error message when a 2.6 schema user doc is present during the authSchemaUpgrade
Branch: master
https://github.com/mongodb/mongo/commit/2399d0d6b32a941e4f2c6435d284227bd0df044a

Generated at Thu Feb 08 03:27:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.