[SERVER-11073] Assertion Failure when trying to create a user Created: 07/Oct/13  Updated: 11/Jul/16  Resolved: 07/Oct/13

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

Type: Bug Priority: Major - P3
Reporter: Luke Lovett Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Operating System: ALL
Steps To Reproduce:

1. Start mongod

mongod --auth --sslOnNormalPorts --sslPEMKeyFile libs/server_338.pem --sslCAFile libs/ca_338.pem --smallfiles --nojournal --dbpath data/db

2. Fire up a mongo shell

mongo --ssl --sslPEMKeyFile libs/client_338.pem
> db.getSiblingDB("$external").runCommand({
    "createUser":"CN=TEST-338-CLIENT,OU=QAClient,O=MongoDB,ST=California,C=US",
    "roles":[
         {name: "readWrite", db:"test", hasRole:true, canDelegate:false},
         {name: "userAdminAnyDatabase", db:"admin", hasRole:true, canDelegate:false}
     ]
})
{
	"errmsg" : "exception: BSONElement: bad type 110",
	"code" : 10320,
	"ok" : 0
}

This is what the mongod log has to say about this:

2013-10-07T22:57:05.661+0000 [conn2] Attempting to lock user data for: Create user
2013-10-07T22:57:05.661+0000 [conn2] Assertion: 10320:BSONElement: bad type 110
2013-10-07T22:57:05.665+0000 [conn2] 0x1052f952b 0x1052b7dd2 0x1052a909f 0x104d352f8 0x104d42326 0x104d68adb 0x104d32f18 0x104d330bd 0x104d32d89 0x104d32acd 0x104dcbe74 0x104dba97f 0x104e7b505 0x104ea8c85 0x104ea9a36 0x104eaa66c 0x104ff893e 0x104ff942d 0x104f8e33a 0x104d0bb84
 0   mongod                              0x00000001052f952b _ZN5mongo15printStackTraceERSo + 43
 1   mongod                              0x00000001052b7dd2 _ZN5mongo10logContextEPKc + 114
 2   mongod                              0x00000001052a909f _ZN5mongo11msgassertedEiPKc + 255
 3   mongod                              0x0000000104d352f8 _ZNK5mongo11BSONElement4sizeEv + 664
 4   mongod                              0x0000000104d42326 _ZN5mongo14BSONObjBuilder8appendAsERKNS_11BSONElementERKNS_10StringDataE + 118
 5   mongod                              0x0000000104d68adb _ZN5mongo16BSONArrayBuilder6appendERKNS_11BSONElementE + 83
 6   mongod                              0x0000000104d32f18 _ZNK5mongo11mutablebson7Element12writeElementINS_16BSONArrayBuilderEEEvPT_PKNS_10StringDataE + 202
 7   mongod                              0x0000000104d330bd _ZNK5mongo11mutablebson7Element13writeChildrenINS_16BSONArrayBuilderEEEvPT_ + 73
 8   mongod                              0x0000000104d32d89 _ZNK5mongo11mutablebson7Element12writeElementINS_14BSONObjBuilderEEEvPT_PKNS_10StringDataE + 587
 9   mongod                              0x0000000104d32acd _ZNK5mongo11mutablebson7Element13writeChildrenINS_14BSONObjBuilderEEEvPT_ + 75
 10  mongod                              0x0000000104dcbe74 _ZN5mongo31AuthzManagerExternalStateMongod18getRoleDescriptionERKNS_8RoleNameEPNS_7BSONObjE + 1912
 11  mongod                              0x0000000104dba97f _ZN5mongo20AuthorizationManager18getRoleDescriptionERKNS_8RoleNameEPNS_7BSONObjE + 27
 12  mongod                              0x0000000104e7b505 _ZN5mongo13CmdCreateUser3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 2831
 13  mongod                              0x0000000104ea8c85 _ZN5mongo12_execCommandEPNS_7CommandERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 37
 14  mongod                              0x0000000104ea9a36 _ZN5mongo7Command11execCommandEPS0_RNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb + 1920
 15  mongod                              0x0000000104eaa66c _ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 1388
 16  mongod                              0x0000000104ff893e _ZN5mongo11runCommandsEPKcRNS_7BSONObjERNS_5CurOpERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 46
 17  mongod                              0x0000000104ff942d _ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 2301
 18  mongod                              0x0000000104f8e33a _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 1818
 19  mongod                              0x0000000104d0bb84 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 308

I have also tried adding a user who has no roles like this in the mongo shell:

> db.getSiblingDB("$external").runCommand({    "createUser":"CN=TEST-338-CLIENT,OU=QAClient,O=MongoDB,ST=California,C=US",    "roles": [] })
{
	"ok" : 0,
	"code" : 35,
	"errmsg" : "0 assertion src/mongo/db/pdfile.h:415"
}
2013-10-07T23:01:22.003+0000 DBClientCursor::init call() failed

And mongod log output for that:

2013-10-07T23:01:21.916+0000 [conn2] Attempting to lock user data for: Create user
2013-10-07T23:01:21.916+0000 [FileAllocator] allocating new datafile data/db/admin.ns, filling with zeroes...
2013-10-07T23:01:21.930+0000 [FileAllocator] done allocating datafile data/db/admin.ns, size: 16MB,  took 0.013 secs
2013-10-07T23:01:21.932+0000 [FileAllocator] allocating new datafile data/db/admin.0, filling with zeroes...
2013-10-07T23:01:21.977+0000 [FileAllocator] done allocating datafile data/db/admin.0, size: 16MB,  took 0.045 secs
2013-10-07T23:01:21.978+0000 [conn2] build index on: admin.system.users properties: { "v" : 1, "key" : { "name" : 1, "db" : 1 }, "unique" : true, "ns" : "admin.system.users", "name" : "name_1_db_1" }
2013-10-07T23:01:21.978+0000 [conn2] have free list for admin.$freelist
2013-10-07T23:01:21.978+0000 [conn2] admin.system.users Assertion failure !isNull() src/mongo/db/diskloc.h 90
2013-10-07T23:01:21.983+0000 [conn2] admin.system.users 0x1052f952b 0x1052b7dd2 0x1052a9362 0x1051928a0 0x10519ad0d 0x105199d66 0x104eee223 0x1050abe3e 0x104f61e1b 0x104f62479 0x104f80cb4 0x1050095c7 0x10500ce17 0x104ecd0de 0x104db8c64 0x104ea4034 0x10500c661 0x10500d354 0x104f88d3e 0x104f8943e
 0   mongod                              0x00000001052f952b _ZN5mongo15printStackTraceERSo + 43
 1   mongod                              0x00000001052b7dd2 _ZN5mongo10logContextEPKc + 114
 2   mongod                              0x00000001052a9362 _ZN5mongo12verifyFailedEPKcS1_j + 274
 3   mongod                              0x00000001051928a0 _ZNK5mongo13ExtentManager9getExtentERKNS_7DiskLocEb + 78
 4   mongod                              0x000000010519ad0d _ZN5mongo12FlatIteratorC2EPKNS_14CollectionTempERKNS_7DiskLocERKNS_20CollectionScanParams9DirectionE + 83
 5   mongod                              0x0000000105199d66 _ZNK5mongo14CollectionTemp11getIteratorERKNS_7DiskLocEbRKNS_20CollectionScanParams9DirectionE + 120
 6   mongod                              0x0000000104eee223 _ZN5mongo14CollectionScan4workEPl + 163
 7   mongod                              0x00000001050abe3e _ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_7DiskLocE + 288
 8   mongod                              0x0000000104f61e1b _ZN5mongo17BtreeBasedBuilder17addKeysToPhaseOneEPNS_16NamespaceDetailsEPKcRKNS_12IndexDetailsERKNS_7BSONObjEPNS_12SortPhaseOneExPNS_13ProgressMeterEbi + 857
 9   mongod                              0x0000000104f62479 _ZN5mongo17BtreeBasedBuilder14fastBuildIndexEPKcPNS_16NamespaceDetailsERNS_12IndexDetailsEbi + 995
 10  mongod                              0x0000000104f80cb4 _ZN5mongo12buildAnIndexERKSsPNS_16NamespaceDetailsERNS_12IndexDetailsEb + 836
 11  mongod                              0x00000001050095c7 _ZN5mongo16insert_makeIndexEPNS_16NamespaceDetailsERKSsRKNS_7DiskLocEb + 631
 12  mongod                              0x000000010500ce17 _ZN5mongo11DataFileMgr6insertEPKcPKvibbbPb + 2751
 13  mongod                              0x0000000104ecd0de _ZN5mongo7Helpers11ensureIndexEPKcNS_7BSONObjEbS2_ + 1256
 14  mongod                              0x0000000104db8c64 _ZN5mongo9authindex19createSystemIndexesERKNS_15NamespaceStringE + 228
 15  mongod                              0x0000000104ea4034 _ZN5mongo8Database16createCollectionERKNS_10StringDataEbPKNS_7BSONObjE + 562
 16  mongod                              0x000000010500c661 _ZN5mongo11DataFileMgr6insertEPKcPKvibbbPb + 777
 17  mongod                              0x000000010500d354 _ZN5mongo11DataFileMgr16insertWithObjModEPKcRNS_7BSONObjEbb + 64
 18  mongod                              0x0000000104f88d3e _ZN5mongo14checkAndInsertEPKcRNS_7BSONObjE + 702
 19  mongod                              0x0000000104f8943e _ZN5mongo14receivedInsertERNS_7MessageERNS_5CurOpE + 1326
2013-10-07T23:01:21.988+0000 [conn2] insert admin.system.users keyUpdates:0 exception: assertion src/mongo/db/diskloc.h:90  72ms
2013-10-07T23:01:21.988+0000 [conn2] admin.system.users Assertion failure dl.a() != -1 src/mongo/db/pdfile.h 415
2013-10-07T23:01:21.994+0000 [conn2] admin.system.users 0x1052f952b 0x1052b7dd2 0x1052a9362 0x10500bc7b 0x1050db205 0x1050dc451 0x1050c2298 0x104ecc846 0x104eccb33 0x104dcac7f 0x104dc667f 0x104dc1680 0x104dcf123 0x104f8de76 0x104f85606 0x104f8581d 0x104d6d9ae 0x104d46202 0x104f85141 0x104d4f192
 0   mongod                              0x00000001052f952b _ZN5mongo15printStackTraceERSo + 43
 1   mongod                              0x00000001052b7dd2 _ZN5mongo10logContextEPKc + 114
 2   mongod                              0x00000001052a9362 _ZN5mongo12verifyFailedEPKcS1_j + 274
 3   mongod                              0x000000010500bc7b _ZN5mongo11DataFileMgr7findAllERKNS_10StringDataERKNS_7DiskLocE + 1055
 4   mongod                              0x00000001050db205 _ZNK5mongo15CursorGenerator14shortcutCursorEv + 515
 5   mongod                              0x00000001050dc451 _ZN5mongo15CursorGenerator8generateEv + 39
 6   mongod                              0x00000001050c2298 _ZN5mongo18getOptimizedCursorERKNS_10StringDataERKNS_7BSONObjES5_RKNS_24QueryPlanSelectionPolicyERKN5boost10shared_ptrIKNS_11ParsedQueryEEEbPNS_16QueryPlanSummaryE + 56
 7   mongod                              0x0000000104ecc846 _ZN5mongo7Helpers7findOneERKNS_10StringDataERKNS_7BSONObjEb + 122
 8   mongod                              0x0000000104eccb33 _ZN5mongo7Helpers7findOneERKNS_10StringDataERKNS_7BSONObjERS4_b + 29
 9   mongod                              0x0000000104dcac7f _ZN5mongo31AuthzManagerExternalStateMongod9_findUserERKSsRKNS_7BSONObjEPS3_ + 145
 10  mongod                              0x0000000104dc667f _ZN5mongo25AuthzManagerExternalState24hasAnyPrivilegeDocumentsEv + 125
 11  mongod                              0x0000000104dc1680 _ZNK5mongo20AuthorizationManager24hasAnyPrivilegeDocumentsEv + 18
 12  mongod                              0x0000000104dcf123 _ZN5mongo37AuthzSessionExternalStateServerCommon26_checkShouldAllowLocalhostEv + 177
 13  mongod                              0x0000000104f8de76 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 598
 14  mongod                              0x0000000104f85606 _ZN5mongo14DBDirectClient4callERNS_7MessageES2_bPSs + 112
 15  mongod                              0x0000000104f8581d _ZThn72_N5mongo14DBDirectClient4callERNS_7MessageES2_bPSs + 13
 16  mongod                              0x0000000104d6d9ae _ZN5mongo14DBClientCursor4initEv + 340
 17  mongod                              0x0000000104d46202 _ZN5mongo12DBClientBase5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii + 180
 18  mongod                              0x0000000104f85141 _ZN5mongo14DBDirectClient5queryERKSsNS_5QueryEiiPKNS_7BSONObjEii + 79
 19  mongod                              0x0000000104d4f192 _ZN5mongo17DBClientInterface5findNERSt6vectorINS_7BSONObjESaIS2_EERKSsNS_5QueryEiiPKS2_i + 156
2013-10-07T23:01:21.997+0000 [conn2] admin.system.users Assertion failure dl.a() != -1 src/mongo/db/pdfile.h 415
2013-10-07T23:01:22.002+0000 [conn2] admin.system.users 0x1052f952b 0x1052b7dd2 0x1052a9362 0x10500bc7b 0x1050db205 0x1050dc451 0x1050c2298 0x104ecc846 0x104eccb33 0x104dcac7f 0x104dc667f 0x104dc1680 0x104dcf123 0x104f8de76 0x104d0bb84 0x1052c5121 0x10532be25 0x7fff94ddb772 0x7fff94dc81a1
 0   mongod                              0x00000001052f952b _ZN5mongo15printStackTraceERSo + 43
 1   mongod                              0x00000001052b7dd2 _ZN5mongo10logContextEPKc + 114
 2   mongod                              0x00000001052a9362 _ZN5mongo12verifyFailedEPKcS1_j + 274
 3   mongod                              0x000000010500bc7b _ZN5mongo11DataFileMgr7findAllERKNS_10StringDataERKNS_7DiskLocE + 1055
 4   mongod                              0x00000001050db205 _ZNK5mongo15CursorGenerator14shortcutCursorEv + 515
 5   mongod                              0x00000001050dc451 _ZN5mongo15CursorGenerator8generateEv + 39
 6   mongod                              0x00000001050c2298 _ZN5mongo18getOptimizedCursorERKNS_10StringDataERKNS_7BSONObjES5_RKNS_24QueryPlanSelectionPolicyERKN5boost10shared_ptrIKNS_11ParsedQueryEEEbPNS_16QueryPlanSummaryE + 56
 7   mongod                              0x0000000104ecc846 _ZN5mongo7Helpers7findOneERKNS_10StringDataERKNS_7BSONObjEb + 122
 8   mongod                              0x0000000104eccb33 _ZN5mongo7Helpers7findOneERKNS_10StringDataERKNS_7BSONObjERS4_b + 29
 9   mongod                              0x0000000104dcac7f _ZN5mongo31AuthzManagerExternalStateMongod9_findUserERKSsRKNS_7BSONObjEPS3_ + 145
 10  mongod                              0x0000000104dc667f _ZN5mongo25AuthzManagerExternalState24hasAnyPrivilegeDocumentsEv + 125
 11  mongod                              0x0000000104dc1680 _ZNK5mongo20AuthorizationManager24hasAnyPrivilegeDocumentsEv + 18
 12  mongod                              0x0000000104dcf123 _ZN5mongo37AuthzSessionExternalStateServerCommon26_checkShouldAllowLocalhostEv + 177
 13  mongod                              0x0000000104f8de76 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 598
 14  mongod                              0x0000000104d0bb84 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 308
 15  mongod                              0x00000001052c5121 _ZN5mongo17PortMessageServer17handleIncomingMsgEPv + 1825
 16  mongod                              0x000000010532be25 thread_proxy + 229
 17  libsystem_c.dylib                   0x00007fff94ddb772 _pthread_start + 327
 18  libsystem_c.dylib                   0x00007fff94dc81a1 thread_start + 13
2013-10-07T23:01:22.003+0000 [conn2] AssertionException handling request, closing client connection: 0 assertion src/mongo/db/pdfile.h:415

Since I'm testing user auth with SSL, I've mostly been testing this with SSL turned on, but here is some output without using SSL.

1. Launch mongod

mongod --auth  --smallfiles --nojournal --dbpath data/db

2. Start a mongo shell:

mongo
> use test
> db.runCommand({
    "createUser":"luke",
    "pwd":"lukepwd",
    "roles":[]
});
2013-10-07T23:13:43.190+0000 trying reconnect to 127.0.0.1:27017
2013-10-07T23:13:43.190+0000 reconnect 127.0.0.1:27017 ok
2013-10-07T23:13:43.195+0000 DBClientCursor::init call() failed
2013-10-07T23:13:43.195+0000 Error: error doing query: failed at src/mongo/shell/query.js:81

This yields the following in the log:

2013-10-07T23:13:09.434+0000 [initandlisten] connection accepted from 127.0.0.1:55842 #3 (1 connection now open)
2013-10-07T23:13:09.434+0000 [conn3] admin.system.users Assertion failure dl.a() != -1 src/mongo/db/pdfile.h 415
2013-10-07T23:13:09.438+0000 [conn3] admin.system.users 0x10ddcc52b 0x10dd8add2 0x10dd7c362 0x10dadec7b 0x10dbae205 0x10dbaf451 0x10db95298 0x10d99f846 0x10d99fb33 0x10d89dc7f 0x10d89967f 0x10d894680 0x10d8a2123 0x10da60e76 0x10d7deb84 0x10dd98121 0x10ddfee25 0x7fff94ddb772 0x7fff94dc81a1
 0   mongod                              0x000000010ddcc52b _ZN5mongo15printStackTraceERSo + 43
 1   mongod                              0x000000010dd8add2 _ZN5mongo10logContextEPKc + 114
 2   mongod                              0x000000010dd7c362 _ZN5mongo12verifyFailedEPKcS1_j + 274
 3   mongod                              0x000000010dadec7b _ZN5mongo11DataFileMgr7findAllERKNS_10StringDataERKNS_7DiskLocE + 1055
 4   mongod                              0x000000010dbae205 _ZNK5mongo15CursorGenerator14shortcutCursorEv + 515
 5   mongod                              0x000000010dbaf451 _ZN5mongo15CursorGenerator8generateEv + 39
 6   mongod                              0x000000010db95298 _ZN5mongo18getOptimizedCursorERKNS_10StringDataERKNS_7BSONObjES5_RKNS_24QueryPlanSelectionPolicyERKN5boost10shared_ptrIKNS_11ParsedQueryEEEbPNS_16QueryPlanSummaryE + 56
 7   mongod                              0x000000010d99f846 _ZN5mongo7Helpers7findOneERKNS_10StringDataERKNS_7BSONObjEb + 122
 8   mongod                              0x000000010d99fb33 _ZN5mongo7Helpers7findOneERKNS_10StringDataERKNS_7BSONObjERS4_b + 29
 9   mongod                              0x000000010d89dc7f _ZN5mongo31AuthzManagerExternalStateMongod9_findUserERKSsRKNS_7BSONObjEPS3_ + 145
 10  mongod                              0x000000010d89967f _ZN5mongo25AuthzManagerExternalState24hasAnyPrivilegeDocumentsEv + 125
 11  mongod                              0x000000010d894680 _ZNK5mongo20AuthorizationManager24hasAnyPrivilegeDocumentsEv + 18
 12  mongod                              0x000000010d8a2123 _ZN5mongo37AuthzSessionExternalStateServerCommon26_checkShouldAllowLocalhostEv + 177
 13  mongod                              0x000000010da60e76 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 598
 14  mongod                              0x000000010d7deb84 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 308
 15  mongod                              0x000000010dd98121 _ZN5mongo17PortMessageServer17handleIncomingMsgEPv + 1825
 16  mongod                              0x000000010ddfee25 thread_proxy + 229
 17  libsystem_c.dylib                   0x00007fff94ddb772 _pthread_start + 327
 18  libsystem_c.dylib                   0x00007fff94dc81a1 thread_start + 13
2013-10-07T23:13:09.439+0000 [conn3] AssertionException handling request, closing client connection: 0 assertion src/mongo/db/pdfile.h:415

At this point, I tried to restart the mongo shell, but the shell exits immediately with the following:

MongoDB shell version: 2.5.3-pre-
connecting to: test
2013-10-07T23:15:04.446+0000 DBClientCursor::init call() failed
2013-10-07T23:15:04.447+0000 Error: DBClientBase::findN: transport error: 127.0.0.1:27017 ns: admin.$cmd query: { whatsmyuri: 1 } at src/mongo/shell/mongo.js:146
exception: connect failed

With the same log output as above.

I'm working with git version of mongodb: af5bab59517363df5c9bfe307525676073677756
OpenSSL version: OpenSSL 0.9.8y 5 Feb 2013

Participants:

 Description   

Following the documentation found at http://codereview.10gen.com/12205003/diff/7001/source/release-notes/2.6.txt, I am unable to create a user.



 Comments   
Comment by auto [ 07/Oct/13 ]

Author:

{u'username': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: SERVER-6405 SERVER-11073: FlatIterator shouldn't fail if collection has no extents
Branch: master
https://github.com/mongodb/mongo/commit/2603ba8d2ae338e18635621dc0965965f0f9c5cb

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