[SERVER-20836] copydb with invalid db name crashes mongos Created: 08/Oct/15  Updated: 25/Jan/17  Resolved: 13/Oct/15

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.1.9
Fix Version/s: 3.2.0-rc0

Type: Bug Priority: Major - P3
Reporter: Robert Guo (Inactive) Assignee: Randolph Tan
Resolution: Done Votes: 0
Labels: fuzzer-blocker
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-19858 Invariant failure in DatabaseType::se... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

var s = new ShardingTest({nodes:2})
var t = s.getDB('test')
 
t.adminCommand({
   copydb: 1,
    fromdb: 'a/b.c',
    todb: 'somedb'
})

Sprint: Sharding B (10/30/15)
Participants:

 Description   

crash affects 3.1.9

[ShardedClusterFixture:job0:mongos] 2015-10-08T20:20:44.877+0000 I -        [conn5] Invariant failure nsIsDbOnly(dbName) src/mongo/s/catalog/replset/catalog_manager_replica_set.cpp 334
 
[ShardedClusterFixture:job0:mongos]  mongos(_ZN5mongo15printStackTraceERSo+0x32) [0xbc4c32]
[ShardedClusterFixture:job0:mongos]  mongos(+0x7C3D99) [0xbc3d99]
[ShardedClusterFixture:job0:mongos]  mongos(+0x7C45A2) [0xbc45a2]
[ShardedClusterFixture:job0:mongos]  libpthread.so.0(+0x10340) [0x7f5f7e28d340]
[ShardedClusterFixture:job0:mongos]  libc.so.6(gsignal+0x39) [0x7f5f7deeecc9]
[ShardedClusterFixture:job0:mongos]  libc.so.6(abort+0x148) [0x7f5f7def20d8]
[ShardedClusterFixture:job0:mongos]  mongos(_ZN5mongo15invariantFailedEPKcS1_j+0xCB) [0xb5195b]
[ShardedClusterFixture:job0:mongos]  mongos(_ZN5mongo24CatalogManagerReplicaSet11getDatabaseEPNS_16OperationContextERKSs+0x3B3) [0xa14e53]
[ShardedClusterFixture:job0:mongos]  mongos(_ZN5mongo24ForwardingCatalogManager11getDatabaseEPNS_16OperationContextERKSs+0x7E) [0x9da71e]
[ShardedClusterFixture:job0:mongos]  mongos(_ZN5mongo12CatalogCache11getDatabaseEPNS_16OperationContextERKSs+0xE5) [0x9c4995]
[ShardedClusterFixture:job0:mongos]  mongos(_ZN5mongo15dbgrid_pub_cmds9CopyDBCmd3runEPNS_16OperationContextERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderE+0x25B) [0xad996b]
[ShardedClusterFixture:job0:mongos]  mongos(_ZN5mongo7Command22execCommandClientBasicEPNS_16OperationContextEPS0_RNS_11ClientBasicEiPKcRNS_7BSONObjERNS_14BSONObjBuilderE+0x701) [0xb00ff1]
[ShardedClusterFixture:job0:mongos]  mongos(_ZN5mongo7Command20runAgainstRegisteredEPNS_16OperationContextEPKcRNS_7BSONObjERNS_14BSONObjBuilderEi+0x2D9) [0xb01c99]
[ShardedClusterFixture:job0:mongos]  mongos(_ZN5mongo8Strategy15clientCommandOpEPNS_16OperationContextERNS_7RequestE+0x1E6) [0xb0f5c6]
[ShardedClusterFixture:job0:mongos]  mongos(_ZN5mongo7Request7processEPNS_16OperationContextEi+0x598) [0xb00448]
[ShardedClusterFixture:job0:mongos]  mongos(_ZN5mongo21ShardedMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortE+0x65) [0x645f05]
[ShardedClusterFixture:job0:mongos]  mongos(_ZN5mongo17PortMessageServer17handleIncomingMsgEPv+0x265) [0xb71c95]
[ShardedClusterFixture:job0:mongos]  libpthread.so.0(+0x8182) [0x7f5f7e285182]
[ShardedClusterFixture:job0:mongos]  libc.so.6(clone+0x6D) [0x7f5f7dfb247d]



 Comments   
Comment by Githook User [ 13/Oct/15 ]

Author:

{u'username': u'renctan', u'name': u'Randolph Tan', u'email': u'randolph@10gen.com'}

Message: SERVER-20836 copydb with invalid db name crashes mongos
Branch: master
https://github.com/mongodb/mongo/commit/2b9ef6f19632d4103e5adfc5b49f60d3621b7b56

Comment by Robert Guo (Inactive) [ 08/Oct/15 ]

behavior on 3.0.7-rc0

 m30999| 2015-10-08T17:03:28.960-0400 I SHARDING [conn1] couldn't find database [somedb] in config db
 m30000| 2015-10-08T17:03:28.967-0400 I STORAGE  [conn8] CMD fsync: sync:1 lock:0
 m30999| 2015-10-08T17:03:28.973-0400 I SHARDING [conn1] 	 put [somedb] on: shard0001:localhost:30001
{
	"code" : 15918,
	"ok" : 0,
	"errmsg" : "exception: invalid database name: a/b"
}

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