[SERVER-1282] Passing 0 to db.collection.stats() causes server to die. Created: 22/Jun/10  Updated: 12/Jul/16  Resolved: 22/Jun/10

Status: Closed
Project: Core Server
Component/s: JavaScript, Shell
Affects Version/s: None
Fix Version/s: 1.5.4

Type: Bug Priority: Minor - P4
Reporter: Doug Hudson Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

db version v1.5.3-pre-, pdfile version 4.5
git version: 783bf1e4d7f5f9caadf73233df59f6672b47120f
sys info: Linux domU-12-31-39-06-79-A1 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41


Operating System: ALL
Participants:

 Description   

Executing the following from a js shell:

db.collection_name.stats(0)

Results in the server crashing with, e.g.:

Tue Jun 22 17:59:42 connection accepted from 127.0.0.1:36607 #1

Tue Jun 22 18:02:50 Got signal: 8 (Floating point exception).
Tue Jun 22 18:02:50 Backtrace:
0x71b299 0x7f2b2aaa8af0 0x708c4a 0x6f2851 0x6f3677 0x5a872f 0x5acd87 0x670f89 0x674060 0x71be7d 0x72e770 0x7f2b2b5ab9ca 0x7f2b2ab5b6cd
./mongod(_ZN5mongo10abruptQuitEi+0x399) [0x71b299]
/lib/libc.so.6(+0x33af0) [0x7f2b2aaa8af0]
./mongod(_ZN5mongo15CollectionStats3runERKSsRNS_7BSONObjERSsRNS_14BSONObjBuilderEb+0x14a) [0x708c4a]
./mongod(_ZN5mongo11execCommandEPNS_7CommandERNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb+0x981) [0x6f2851]
./mongod(_ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_10BufBuilderERNS_14BSONObjBuilderEbi+0x6e7) [0x6f3677]
./mongod(_ZN5mongo11runCommandsEPKcRNS_7BSONObjERNS_5CurOpERNS_10BufBuilderERNS_14BSONObjBuilderEbi+0x3f) [0x5a872f]
./mongod(ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1+0x18f7) [0x5acd87]
./mongod() [0x670f89]
./mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_8SockAddrE+0x1290) [0x674060]
./mongod(_ZN5mongo10connThreadEv+0x2cd) [0x71be7d]
./mongod(thread_proxy+0x80) [0x72e770]
/lib/libpthread.so.0(+0x69ca) [0x7f2b2b5ab9ca]
/lib/libc.so.6(clone+0x6d) [0x7f2b2ab5b6cd]
Tue Jun 22 18:02:50 dbexit:
Tue Jun 22 18:02:50 shutdown: going to close listening sockets...
Tue Jun 22 18:02:50 going to close listening socket: 5
Tue Jun 22 18:02:50 going to close listening socket: 6
Tue Jun 22 18:02:50 going to close listening socket: 7
Tue Jun 22 18:02:50 going to close listening socket: 8
Tue Jun 22 18:02:50 shutdown: going to flush oplog...
Tue Jun 22 18:02:50 shutdown: going to close sockets...
Tue Jun 22 18:02:50 shutdown: waiting for fs preallocator...
Tue Jun 22 18:02:50 shutdown: closing all files...
Tue Jun 22 18:02:50 closeAllFiles() finished
Tue Jun 22 18:02:50 shutdown: removing fs lock...
Tue Jun 22 18:02:50 dbexit: really exiting now
ERROR: Client::~Client _context should be NULL: conn

Reporter understands that stats shouldn't be passed an argument, but doing this by accident shouldn't cause server to die.

FYI the shell is issuing the following command:

{ collstats: "author_count", scale: 0.0 }

 Comments   
Comment by auto [ 22/Jun/10 ]

Author:

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

Message: fix scale of 0 breaking command SERVER-1282
http://github.com/mongodb/mongo/commit/dba012b66501c3049677b077c96534eb47e3892b

Generated at Thu Feb 08 02:56:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.