[SERVER-10083] mongos does not validate port and accepts values outside of valid range Created: 02/Jul/13  Updated: 10/Dec/14  Resolved: 27/Aug/13

Status: Closed
Project: Core Server
Component/s: Admin, Usability
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Ryan Nitz Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-7808 mongos allows you to specify an inval... Closed
Operating System: ALL
Participants:

 Description   

mongos does not validate port and accepts values outside of valid range.

This was found when I added port validation to MMS (there are users running with values outside the normal range in production).

I started mongos using:

  • mongos --port 87161 --configdb localhost:27022

mongos> db.mongos.find().pretty();
{
	"_id" : "my.local:27017",
	"mongoVersion" : "2.4.4",
	"ping" : ISODate("2013-07-02T19:10:40.901Z"),
	"up" : 256,
	"waiting" : true
}
{
	"_id" : "my.local:27030",
	"mongoVersion" : "2.4.4",
	"ping" : ISODate("2013-07-02T19:10:40.445Z"),
	"up" : 252,
	"waiting" : true
}
{
	"_id" : "my.local:87161",
	"mongoVersion" : "2.4.4",
	"ping" : ISODate("2013-07-02T19:10:41.305Z"),
	"up" : 184,
	"waiting" : true
}



 Comments   
Comment by Matt Kangas [ 27/Aug/13 ]

See SERVER-7808

Comment by Ryan Nitz [ 02/Jul/13 ]

This was all tested on 2.4.4.

FYI - here is the dump from mongod:

Tue Jul  2 15:01:56.306 bad --port number
Tue Jul  2 15:01:56.306 dbexit:
Tue Jul  2 15:01:56.306 shutdown: going to close listening sockets...
Tue Jul  2 15:01:56.306 shutdown: going to flush diaglog...
Tue Jul  2 15:01:56.306 shutdown: going to close sockets...
Tue Jul  2 15:01:56.306 shutdown: waiting for fs preallocator...
Tue Jul  2 15:01:56.306 shutdown: lock for final commit...
Tue Jul  2 15:01:56.306   Assertion failure c src/mongo/db/client.h 235
0x100443bab 0x10041d90c 0x100136a28 0x100136b63 0x100136deb 0x100136f18 0x1001e42bd 0x100009445 0x10000b633 0x100001154 0x9
0   mongod                              0x0000000100443bab _ZN5mongo15printStackTraceERSo + 43
1   mongod                              0x000000010041d90c _ZN5mongo12verifyFailedEPKcS1_j + 284
2   mongod                              0x0000000100136a28 _ZN5mongo4Lock10ScopedLock6relockEv + 0
 3   mongod                              0x0000000100136b63 _ZN5mongo4Lock10ScopedLockC2Ec + 39
 4   mongod                              0x0000000100136deb _ZN5mongo4Lock10GlobalReadC2Ei + 29
 5   mongod                              0x0000000100136f18 _ZN5mongo11readlocktryC2Ei + 50
 6   mongod                              0x00000001001e42bd _ZN5mongo6dbexitENS_8ExitCodeEPKc + 861
 7   mongod                              0x0000000100009445 _ZL25processCommandLineOptionsRKSt6vectorISsSaISsEE + 17397
 8   mongod                              0x000000010000b633 main + 467
 9   mongod                              0x0000000100001154 start + 52
 10  ???                                 0x0000000000000009 0x0 + 9
Tue Jul  2 15:01:56.334 shutdown failed with exception
Tue Jul  2 15:01:56.334 dbexit: really exiting now

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