Bug 677411

Summary: test version segfaults in constructor
Product: [Fedora] Fedora Reporter: Jim Meyering <meyering>
Component: mongodbAssignee: Ionuț Arțăriși <ionut>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ionut, nathaniel
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-19 16:02:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Jim Meyering 2011-02-14 17:15:29 UTC
Description of problem: test version segfaults very early


Version-Release number of selected component (if applicable):
Note: this is not yet in rawhide: mongodb-1.7.5-4.fc15
http://koji.fedoraproject.org/koji/buildinfo?buildID=228448

How reproducible: always


Steps to Reproduce:
1. install those RPMs, and then run this:
2. mkdir mongod \
  && gdb --args mongod --port 27018 --pidfilepath mongod/pid --dbpath mongod
3. type "run"
  
Actual results:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7934549 in std::basic_istream<char, std::char_traits<char> >::read(cha
r*, long) () from /usr/lib64/libstdc++.so.6
Missing separate debuginfos, use: debuginfo-install boost-filesystem-1.46.0-0.1.b
eta1.fc15.x86_64 boost-program-options-1.46.0-0.1.beta1.fc15.x86_64 boost-system-
1.46.0-0.1.beta1.fc15.x86_64 boost-thread-1.46.0-0.1.beta1.fc15.x86_64 glibc-2.13
.90-3.x86_64 js-1.70-13.fc15.x86_64 libgcc-4.6.0-0.6.fc15.1.x86_64 libstdc++-4.6.
0-0.6.fc15.1.x86_64 nspr-4.8.7-2.fc15.x86_64 pcre-8.12-2.fc15.x86_64
(gdb) l 
604                     if (old_arbiter == "-" || old_arbiter.substr(0, 1) != "-"
) {
605                         return "Specifying arbiter using --pairwith is no lon
ger supported, please use --arbiter";
606                     }
607                 }
608             }
609         }
610         return "";
611     }
612
613     int main(int argc, char* argv[]) {
(gdb) up
#1  0x000000000052229a in mongo::Security::getNonce (this=0xad1500)
    at db/nonce.cpp:63
63              _devrandom->read((char*)&n, sizeof(n));
(gdb) bt
#0  0x00007ffff7934549 in std::basic_istream<char, std::char_traits<char> >::read
(char*, long) () from /usr/lib64/libstdc++.so.6
#1  0x000000000052229a in mongo::Security::getNonce (this=0xad1500)
    at db/nonce.cpp:63
#2  0x000000000050dc0a in mongo::OID::genMachineAndPid () at bson/oid.cpp:56
#3  0x00000000004e54ca in __static_initialization_and_destruction_0 (
    __priority=65535, __initialize_p=1) at bson/oid.cpp:69
#4  _GLOBAL__sub_I_oid.cpp(void) () at bson/oid.cpp:154
#5  0x00000000007bf31d in __libc_csu_init ()
#6  0x00007ffff60ef290 in __libc_start_main () from /lib64/libc.so.6
#7  0x00000000004f2ff1 in _start () at ./util/log.h:445
(gdb) p _devrandom
$1 = (std::ifstream *) 0x0

Expected results:

no segfault

Additional info:

I rebuilt using the attached patch (to call 'init()' before using _devrandom)
and the resulting tools worked fine as used by iwhd, which then passed its "make check" tests.

Comment 1 Nathaniel McCallum 2011-03-19 16:02:07 UTC
This is fixed in rawhide as a slightly different version of the patch was merged upstream and is in the 1.8.0 release.