[SERVER-18939] Using <rs name>/localhost to configure mongos causes segfault Created: 12/Jun/15  Updated: 25/Jan/17  Resolved: 12/Jun/15

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 3.1.4
Fix Version/s: 3.1.5

Type: Bug Priority: Major - P3
Reporter: Bernie Hackett Assignee: Spencer Brody (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Create a one member replica set for use as a config server. Start mongos with --configdb "<rs name>/localhost:<port>".

Sprint: Sharding 5 06/26/16
Participants:

 Description   

When starting mongos with a single node replica set config server, using localhost as the hostname of the primary causes mongos to segfault.

$ ./mongos --configdb "configRepl/localhost:20000"
2015-06-11T17:00:54.620-0700 W SHARDING [main] running with less than 3 config servers should be done only for testing purposes and is not recommended for production
2015-06-11T17:00:54.625-0700 I CONTROL  [main] 
2015-06-11T17:00:54.625-0700 I CONTROL  [main] ** NOTE: This is a development version (3.1.5-pre-) of MongoDB.
2015-06-11T17:00:54.625-0700 I CONTROL  [main] **       Not recommended for production.
2015-06-11T17:00:54.625-0700 I CONTROL  [main] 
2015-06-11T17:00:54.625-0700 I SHARDING [mongosMain] MongoS version 3.1.5-pre- starting: pid=24844 port=27017 64-bit host=behackett-dt (--help for usage)
2015-06-11T17:00:54.625-0700 I CONTROL  [mongosMain] db version v3.1.5-pre-
2015-06-11T17:00:54.625-0700 I CONTROL  [mongosMain] git version: 2cd33990466931e4ac06ddeedbdf217885eec1cb
2015-06-11T17:00:54.625-0700 I CONTROL  [mongosMain] OpenSSL version: OpenSSL 1.0.1m 19 Mar 2015
2015-06-11T17:00:54.625-0700 I CONTROL  [mongosMain] allocator: tcmalloc
2015-06-11T17:00:54.625-0700 I CONTROL  [mongosMain] options: { sharding: { configDB: "configRepl/localhost:20000" } }
2015-06-11T17:00:54.626-0700 I NETWORK  [mongosMain] starting new replica set monitor for replica set configRepl with seeds 
2015-06-11T17:00:54.626-0700 I NETWORK  [mongosMain] localhost:20000
2015-06-11T17:00:54.626-0700 I NETWORK  [ReplicaSetMonitorWatcher] starting
2015-06-11T17:00:54.626-0700 I NETWORK  [mongosMain] changing hosts to configRepl/behackett-dt:20000 from configRepl/localhost:20000
2015-06-11T17:00:54.626-0700 F -        [replSetChange] Invalid access at address: 0x30
2015-06-11T17:00:54.628-0700 F -        [replSetChange] Got signal: 11 (Segmentation fault).
 
 0xa6d886 0xa6cfa2 0xa6d2de 0x7f811aac5d30 0x7f811aac0047 0x949d68 0x943a47 0x99e5e4 0xabd5d3 0x7f811aabe204 0x7f811a80539d
----- BEGIN BACKTRACE -----
{"backtrace":[{"b":"400000","o":"66D886"},{"b":"400000","o":"66CFA2"},{"b":"400000","o":"66D2DE"},{"b":"7F811AAB6000","o":"FD30"},{"b":"7F811AAB6000","o":"A047"},{"b":"400000","o":"549D68"},{"b":"400000","o":"543A47"},{"b":"400000","o":"59E5E4"},{"b":"400000","o":"6BD5D3"},{"b":"7F811AAB6000","o":"8204"},{"b":"7F811A71E000","o":"E739D"}],"processInfo":{ "mongodbVersion" : "3.1.5-pre-", "gitVersion" : "2cd33990466931e4ac06ddeedbdf217885eec1cb", "compiledModules" : [ "subscription" ], "uname" : { "sysname" : "Linux", "release" : "3.18.12-gentoo", "version" : "#2 SMP PREEMPT Tue May 26 15:22:47 PDT 2015", "machine" : "x86_64" }, "somap" : [ { "elfType" : 2, "b" : "400000" }, { "b" : "7FFC3E326000", "path" : "linux-vdso.so.1", "elfType" : 3, "buildId" : "0A7A2A573DB41C758905DBB4FB669EBBCC015F22" }, { "b" : "7F811C17F000", "path" : "/usr/lib64/libsasl2.so.3", "elfType" : 3 }, { "b" : "7F811BF36000", "path" : "/usr/lib64/libgssapi_krb5.so.2", "elfType" : 3 }, { "b" : "7F811BCC7000", "path" : "/usr/lib64/libssl.so.1.0.0", "elfType" : 3 }, { "b" : "7F811B8F7000", "path" : "/usr/lib64/libcrypto.so.1.0.0", "elfType" : 3 }, { "b" : "7F811B6EF000", "path" : "/lib64/librt.so.1", "elfType" : 3 }, { "b" : "7F811B4EB000", "path" : "/lib64/libdl.so.2", "elfType" : 3 }, { "b" : "7F811B1E7000", "path" : "/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.4/libstdc++.so.6", "elfType" : 3 }, { "b" : "7F811AEE7000", "path" : "/lib64/libm.so.6", "elfType" : 3 }, { "b" : "7F811ACD1000", "path" : "/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.4/libgcc_s.so.1", "elfType" : 3 }, { "b" : "7F811AAB6000", "path" : "/lib64/libpthread.so.0", "elfType" : 3 }, { "b" : "7F811A71E000", "path" : "/lib64/libc.so.6", "elfType" : 3 }, { "b" : "7F811C39C000", "path" : "/lib64/ld-linux-x86-64.so.2", "elfType" : 3 }, { "b" : "7F811A507000", "path" : "/lib64/libresolv.so.2", "elfType" : 3 }, { "b" : "7F811A234000", "path" : "/usr/lib64/libkrb5.so.3", "elfType" : 3 }, { "b" : "7F811A003000", "path" : "/usr/lib64/libk5crypto.so.3", "elfType" : 3 }, { "b" : "7F8119DFF000", "path" : "/lib64/libcom_err.so.2", "elfType" : 3 }, { "b" : "7F8119BF3000", "path" : "/usr/lib64/libkrb5support.so.0", "elfType" : 3 }, { "b" : "7F81199EF000", "path" : "/lib64/libkeyutils.so.1", "elfType" : 3 }, { "b" : "7F81197D9000", "path" : "/lib64/libz.so.1", "elfType" : 3 }, { "b" : "7F81195D4000", "path" : "/usr/lib64/sasl2/liblogin.so", "elfType" : 3 }, { "b" : "7F8119377000", "path" : "/lib64/libcrypt.so.1", "elfType" : 3 }, { "b" : "7F8119170000", "path" : "/usr/lib64/sasl2/libsasldb.so", "elfType" : 3 }, { "b" : "7F8118F64000", "path" : "/usr/lib64/libgdbm.so.4", "elfType" : 3 }, { "b" : "7F8118D5F000", "path" : "/usr/lib64/sasl2/libanonymous.so", "elfType" : 3 }, { "b" : "7F8118B59000", "path" : "/usr/lib64/sasl2/libcrammd5.so", "elfType" : 3 }, { "b" : "7F8118950000", "path" : "/usr/lib64/sasl2/libntlm.so", "elfType" : 3 }, { "b" : "7F811874A000", "path" : "/usr/lib64/sasl2/libsql.so", "elfType" : 3 }, { "b" : "7F8118481000", "path" : "/usr/lib64/libsqlite3.so.0", "elfType" : 3 }, { "b" : "7F8118026000", "path" : "/usr/lib64/libicui18n.so.55", "elfType" : 3 }, { "b" : "7F8117C99000", "path" : "/usr/lib64/libicuuc.so.55", "elfType" : 3 }, { "b" : "7F81161E2000", "path" : "/usr/lib64/libicudata.so.55", "elfType" : 3 }, { "b" : "7F8115FD8000", "path" : "/usr/lib64/sasl2/libscram.so", "elfType" : 3 }, { "b" : "7F8115DCA000", "path" : "/usr/lib64/sasl2/libdigestmd5.so", "elfType" : 3 }, { "b" : "7F8115BC1000", "path" : "/usr/lib64/sasl2/libgs2.so", "elfType" : 3 }, { "b" : "7F81159BC000", "path" : "/usr/lib64/sasl2/libplain.so", "elfType" : 3 }, { "b" : "7F81157A2000", "path" : "/usr/lib64/sasl2/libotp.so", "elfType" : 3 }, { "b" : "7F8115599000", "path" : "/usr/lib64/sasl2/libgssapiv2.so", "elfType" : 3 } ] }}
 mongos(_ZN5mongo15printStackTraceERSo+0x26) [0xa6d886]
 mongos(+0x66CFA2) [0xa6cfa2]
 mongos(+0x66D2DE) [0xa6d2de]
 libpthread.so.0(+0xFD30) [0x7f811aac5d30]
 libpthread.so.0(pthread_mutex_lock+0x7) [0x7f811aac0047]
 mongos(_ZN5mongo13ShardRegistry12lookupRSNameERKSs+0x28) [0x949d68]
 mongos(_ZN5mongo5Shard12lookupRSNameERKSs+0x17) [0x943a47]
 mongos(_ZN5mongo12ConfigServer16replicaSetChangeERKSsS2_+0x44) [0x99e5e4]
 mongos(+0x6BD5D3) [0xabd5d3]
 libpthread.so.0(+0x8204) [0x7f811aabe204]
 libc.so.6(clone+0x6D) [0x7f811a80539d]
-----  END BACKTRACE  -----

Using the actual hostname of the local machine allows mongos to start without issue.



 Comments   
Comment by Githook User [ 12/Jun/15 ]

Author:

{u'username': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@mongodb.com'}

Message: SERVER-18939 Fix mongos initialization so that config server's rs config can safely change during startup
Branch: master
https://github.com/mongodb/mongo/commit/45ef86556ebea162dadf32c392ab3cd4f0ad7ef7

Comment by Spencer Brody (Inactive) [ 12/Jun/15 ]

I believe this is due to the replset config passed on the mongos command line not matching the config stored in mongod replset config, causing the configChangeHook to run, but it's running during startup before the shard registry has been installed into the global grid object. We need to reshuffle the initialization order a bit.

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