[SERVER-37749] replSetResizeOplog command does not validate argument Created: 25/Oct/18  Updated: 29/Oct/23  Resolved: 29/Oct/18

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: 3.6.8
Fix Version/s: 3.4.19, 3.6.9, 4.0.4, 4.1.5

Type: Bug Priority: Major - P3
Reporter: Eric Sommer Assignee: Louis Williams
Resolution: Fixed Votes: 2
Labels: bkp
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
is related to SERVER-22766 Dynamic oplog sizing for WiredTiger n... Closed
is related to SERVER-37806 oplogSize config option should valida... Backlog
is related to SERVER-37807 startup warning if oplog maxSize exce... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.0, v3.6, v3.4
Steps To Reproduce:

Run:

db.adminCommand({replSetResizeOplog:1, size: <size>})

Where size is bytes (output of db.oplog.rs.stats().maxSize ) instead of expected megabtyes.

Sprint: Storage NYC 2018-11-05
Participants:
Case:

 Description   

replSetResizeOplog command apparently does not validate the requested oplog size. A too-large value can result in the following error:

2018-10-25T12:05:15.180+0000 F -        [initandlisten] Invariant failure _cappedMaxSize > 0 src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp 638
2018-10-25T12:05:15.180+0000 F -        [initandlisten]
 
***aborting after invariant() failure
 
 
2018-10-25T12:05:15.191+0000 F -        [initandlisten] Got signal: 6 (Aborted).
 
 0x55f1ce1c6991 0x55f1ce1c5ba9 0x55f1ce1c608d 0x7f7baa644330 0x7f7baa2a1c37 0x7f7baa2a5028 0x55f1cc7da61a 0x55f1cccd2ae0 0x55f1cccd2d13 0x55f1cccbfc94 0x55f1cc99c7ce 0x55f1cc996f06 0x55f1cc98eec6 0x55f1cc9be907 0x55f1cc76d68c 0x55f1cc855
ffc 0x55f1cc7dc739 0x7f7baa28cf45 0x55f1cc845a1f
----- BEGIN BACKTRACE -----
{"backtrace":[{"b":"55F1CBE13000","o":"23B3991","s":"_ZN5mongo15printStackTraceERSo"},{"b":"55F1CBE13000","o":"23B2BA9"},{"b":"55F1CBE13000","o":"23B308D"},{"b":"7F7BAA634000","o":"10330"},{"b":"7F7BAA26B000","o":"36C37","s":"gsignal"},{
"b":"7F7BAA26B000","o":"3A028","s":"abort"},{"b":"55F1CBE13000","o":"9C761A","s":"_ZN5mongo22invariantFailedWithMsgEPKcS1_S1_j"},{"b":"55F1CBE13000","o":"EBFAE0","s":"_ZN5mongo21WiredTigerRecordStoreC1EPNS_18WiredTigerKVEngineEPNS_16Oper
ationContextENS0_6ParamsE"},{"b":"55F1CBE13000","o":"EBFD13","s":"_ZN5mongo29StandardWiredTigerRecordStoreC1EPNS_18WiredTigerKVEngineEPNS_16OperationContextENS_21WiredTigerRecordStore6ParamsE"},{"b":"55F1CBE13000","o":"EACC94","s":"_ZN5m
ongo18WiredTigerKVEngine21getGroupedRecordStoreEPNS_16OperationContextENS_10StringDataES3_RKNS_17CollectionOptionsENS_8KVPrefixE"},{"b":"55F1CBE13000","o":"B897CE","s":"_ZN5mongo26KVDatabaseCatalogEntryBase14initCollectionEPNS_16Operatio
nContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb"},{"b":"55F1CBE13000","o":"B83F06","s":"_ZN5mongo15KVStorageEngineC2EPNS_8KVEngineERKNS_22KVStorageEngineOptionsESt8functionIFSt10unique_ptrINS_26KVDatabaseCatalogEntryBase
ESt14default_deleteIS8_EENS_10StringDataEPS0_EE"},{"b":"55F1CBE13000","o":"B7BEC6"},{"b":"55F1CBE13000","o":"BAB907","s":"_ZN5mongo20ServiceContextMongoD29initializeGlobalStorageEngineEv"},{"b":"55F1CBE13000","o":"95A68C"},{"b":"55F1CBE1
3000","o":"A42FFC","s":"_ZN5mongo11mongoDbMainEiPPcS1_"},{"b":"55F1CBE13000","o":"9C9739","s":"main"},{"b":"7F7BAA26B000","o":"21F45","s":"__libc_start_main"},{"b":"55F1CBE13000","o":"A32A1F"}],"processInfo":{ "mongodbVersion" : "3.6.8",
 "gitVersion" : "6bc9ed599c3fa164703346a22bad17e33fa913e4", "compiledModules" : [ "enterprise" ], "uname" : { "sysname" : "Linux", "release" : "4.4.0-116-generic", "version" : "#140~14.04.1-Ubuntu SMP Fri Feb 16 09:25:20 UTC 2018", "mach
ine" : "x86_64" }, "somap" : [ { "b" : "55F1CBE13000", "elfType" : 3, "buildId" : "4804D843E89DE0B43C0958F809D05629A184B489" }, { "b" : "7FFF121D4000", "elfType" : 3, "buildId" : "BE3E960B17B4FD2D1F0C63E4F9DD999BB17BB15A" }, { "b" : "7F7
BAD055000", "path" : "/usr/lib/x86_64-linux-gnu/libcurl.so.4", "elfType" : 3, "buildId" : "1410F4EAF8B794005B7D350DD3A3C621E4A085E7" }, { "b" : "7F7BACBEA000", "path" : "/var/vcap/packages/net-snmp/lib/libnetsnmpmibs.so.30", "elfType" :
3, "buildId" : "4D6443E04807C9FBE8CB4682537E57EDDF6BC79C" }, { "b" : "7F7BAC9DB000", "path" : "/usr/lib/x86_64-linux-gnu/libsensors.so.4", "elfType" : 3, "buildId" : "859FDBFDD82F0EFDEB44A433D9D8020A232A35E2" }, { "b" : "7F7BAC7D7000", "
path" : "/lib/x86_64-linux-gnu/libdl.so.2", "elfType" : 3, "buildId" : "034D6A4EE9DCAB4A34ABD644345CBBB42DC63088" }, { "b" : "7F7BAC575000", "path" : "/var/vcap/packages/net-snmp/lib/libnetsnmpagent.so.30", "elfType" : 3, "buildId" : "69
2A527844C97BDB7577A5D0C1D5750C46D3E399" }, { "b" : "7F7BAC36B000", "path" : "/lib/x86_64-linux-gnu/libwrap.so.0", "elfType" : 3, "buildId" : "54FCBC5B0F994A13A9B0EAD46F23E7DA7F7FE75B" }, { "b" : "7F7BAC08E000", "path" : "/var/vcap/packag
es/net-snmp/lib/libnetsnmp.so.30", "elfType" : 3, "buildId" : "25621A015B6F7B82F44E819CBDAE64601289C753" }, { "b" : "7F7BABCB2000", "path" : "/lib/x86_64-linux-gnu/libcrypto.so.1.0.0", "elfType" : 3, "buildId" : "3F882E7949FA0CB52422985A
88CDD7E6182CBD70" }, { "b" : "7F7BABA97000", "path" : "/usr/lib/x86_64-linux-gnu/libsasl2.so.2", "elfType" : 3, "buildId" : "666B276BD134B0E9579B67D4EE333F2D0FB813CD" }, { "b" : "7F7BAB846000", "path" : "/usr/lib/x86_64-linux-gnu/libldap
_r-2.4.so.2", "elfType" : 3, "buildId" : "3977964C08DE122A837BFB85F417EBC0043026E0" }, { "b" : "7F7BAB637000", "path" : "/usr/lib/x86_64-linux-gnu/liblber-2.4.so.2", "elfType" : 3, "buildId" : "5CFA76EE2C237A69D854D21B39361A8CB227AF55" }
, { "b" : "7F7BAB3F0000", "path" : "/usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2", "elfType" : 3, "buildId" : "9D2FCF6348296B7A32F26D3D5D11AD3FD2B1791D" }, { "b" : "7F7BAB0EA000", "path" : "/lib/x86_64-linux-gnu/libm.so.6", "elfType" :
3, "buildId" : "300C7884CDEB5667BEA2357D2B8E7A76397562D6" }, { "b" : "7F7BAAECF000", "path" : "/lib/x86_64-linux-gnu/libresolv.so.2", "elfType" : 3, "buildId" : "AD304AFCE6847F7A4D66D22853E87CCBF5A66966" }, { "b" : "7F7BAAC70000", "path"
 : "/lib/x86_64-linux-gnu/libssl.so.1.0.0", "elfType" : 3, "buildId" : "1287BAA0C3440FDF4F9A5AB267445129A9DBD14E" }, { "b" : "7F7BAAA68000", "path" : "/lib/x86_64-linux-gnu/librt.so.1", "elfType" : 3, "buildId" : "4F930712D3609C93E380E5B
E5DF73E7AD273531C" }, { "b" : "7F7BAA852000", "path" : "/lib/x86_64-linux-gnu/libgcc_s.so.1", "elfType" : 3, "buildId" : "36311B4457710AE5578C4BF00791DED7359DBB92" }, { "b" : "7F7BAA634000", "path" : "/lib/x86_64-linux-gnu/libpthread.so.
0", "elfType" : 3, "buildId" : "F64B8AD471FBA1B7A3A64EFB01551E694975E1F7" }, { "b" : "7F7BAA26B000", "path" : "/lib/x86_64-linux-gnu/libc.so.6", "elfType" : 3, "buildId" : "D9A10B8EF90300628DD0A3A535106967714D7328" }, { "b" : "7F7BAD2BC0
00", "path" : "/lib64/ld-linux-x86-64.so.2", "elfType" : 3, "buildId" : "2CA513EDC89C7BC06EC183D1A3A03CC0F606319C" }, { "b" : "7F7BAA038000", "path" : "/usr/lib/x86_64-linux-gnu/libidn.so.11", "elfType" : 3, "buildId" : "A4CF3D2F3AD65050
A8199AFC54BD29893EE88902" }, { "b" : "7F7BA9E1E000", "path" : "/usr/lib/x86_64-linux-gnu/librtmp.so.0", "elfType" : 3, "buildId" : "B194D58FAD21CCFA9B4321CA687678D82B712994" }, { "b" : "7F7BA9C05000", "path" : "/lib/x86_64-linux-gnu/libz
.so.1", "elfType" : 3, "buildId" : "7EE9BC42787A0F9A793BDBFCB0671FD12C52BC2A" }, { "b" : "7F7BA99EB000", "path" : "/lib/x86_64-linux-gnu/libnsl.so.1", "elfType" : 3, "buildId" : "77E8046EDCD924AF0081170F3E3BDC4317CCE6A0" }, { "b" : "7F7B
A97AD000", "path" : "/usr/lib/x86_64-linux-gnu/libgssapi.so.3", "elfType" : 3, "buildId" : "3DD3615C50982A067E390FC2443D7EF749ADAA4D" }, { "b" : "7F7BA94EE000", "path" : "/usr/lib/x86_64-linux-gnu/libgnutls.so.26", "elfType" : 3, "buildId" : "31C8FF1B8CFAA077ECE92C00C11FCAB72272C5E2" }, { "b" : "7F7BA926E000", "path" : "/lib/x86_64-linux-gnu/libgcrypt.so.11", "elfType" : 3, "buildId" : "3E51DF9F5A1C220A2F97CF20EAC75A072D19BB68" }, { "b" : "7F7BA8FA3000", "path" : "/usr/lib/x86_64-linux-gnu/libkrb5.so.3", "elfType" : 3, "buildId" : "C112360456F395F788CAA854ACEBF95AC441DED2" }, { "b" : "7F7BA8D74000", "path" : "/usr/lib/x86_64-linux-gnu/libk5crypto.so.3", "elfType" : 3, "buildId" : "E5872A99489E062379C657B3EA04E486DA966DAC" }, { "b" : "7F7BA8B70000", "path" : "/lib/x86_64-linux-gnu/libcom_err.so.2", "elfType" : 3, "buildId" : "8D56938ABD6462C4C29822D8E48A131BE1C61F6A" }, { "b" : "7F7BA8965000", "path" : "/usr/lib/x86_64-linux-gnu/libkrb5support.so.0", "elfType" : 3, "buildId" : "7890C13210DCE1CF157FD3AC84022ADC346D4702" }, { "b" : "7F7BA875C000", "path" : "/usr/lib/x86_64-linux-gnu/libheimntlm.so.0", "elfType" : 3, "buildId" : "F284B367B83FC07B7309FA086DC6634C9CC8A005" }, { "b" : "7F7BA84D4000", "path" : "/usr/lib/x86_64-linux-gnu/libkrb5.so.26", "elfType" : 3, "buildId" : "7CC32240A00456FA57B74BFB922E31BA8EEF57C2" }, { "b" : "7F7BA8233000", "path" : "/usr/lib/x86_64-linux-gnu/libasn1.so.8", "elfType" : 3, "buildId" : "7CF4C34552B60E44902EA2DFCC4EE4906A90DE3C" }, { "b" : "7F7BA8000000", "path" : "/usr/lib/x86_64-linux-gnu/libhcrypto.so.4", "elfType" : 3, "buildId" : "5F0EF0E1DDE5070F686668B93E6A9BEC44D83220" }, { "b" : "7F7BA7DEB000", "path" : "/usr/lib/x86_64-linux-gnu/libroken.so.18", "elfType" : 3, "buildId" : "DF1229739A9F5E6A9850B519C95D8A811B63B8EF" }, { "b" : "7F7BA7BD7000", "path" : "/usr/lib/x86_64-linux-gnu/libtasn1.so.6", "elfType" : 3, "buildId" : "1477FEC6F18A279343616F89650A2737E83358C0" }, { "b" : "7F7BA7995000", "path" : "/usr/lib/x86_64-linux-gnu/libp11-kit.so.0", "elfType" : 3, "buildId" : "D4B5C925023E4142D335EEFB6106F47245A3F97C" }, { "b" : "7F7BA7790000", "path" : "/lib/x86_64-linux-gnu/libgpg-error.so.0", "elfType" : 3, "buildId" : "38CA3EE1AE3847D38BF2F3ED9CA1A17FAC217CF7" }, { "b" : "7F7BA758C000", "path" : "/lib/x86_64-linux-gnu/libkeyutils.so.1", "elfType" : 3, "buildId" : "0F03635F97B93D3DACD84F0ED363C56BD266044F" }, { "b" : "7F7BA7363000", "path" : "/usr/lib/x86_64-linux-gnu/libwind.so.0", "elfType" : 3, "buildId" : "DBCF291C6CF70F0D0BF62F07347AEF28E040E1A5" }, { "b" : "7F7BA7155000", "path" : "/usr/lib/x86_64-linux-gnu/libheimbase.so.1", "elfType" : 3, "buildId" : "F4FDBD38788250E843523FFEA869A4DA933B6BBC" }, { "b" : "7F7BA6F0C000", "path" : "/usr/lib/x86_64-linux-gnu/libhx509.so.5", "elfType" : 3, "buildId" : "C03FF77D3A35A40589C712C74A8597FF532C8ED7" }, { "b" : "7F7BA6C53000", "path" : "/usr/lib/x86_64-linux-gnu/libsqlite3.so.0", "elfType" : 3, "buildId" : "1CCADF3419D91F928B4C9F59740F6BA89EC80624" }, { "b" : "7F7BA6A1A000", "path" : "/lib/x86_64-linux-gnu/libcrypt.so.1", "elfType" : 3, "buildId" : "A2CA559CCEB691EF8623361D52671E146DC0B06C" }, { "b" : "7F7BA6812000", "path" : "/usr/lib/x86_64-linux-gnu/libffi.so.6", "elfType" : 3, "buildId" : "C114D2C23BD2F3B1705F37FBF9CA06163C8B89A6" } ] }}
 mongod(_ZN5mongo15printStackTraceERSo+0x41) [0x55f1ce1c6991]
 mongod(+0x23B2BA9) [0x55f1ce1c5ba9]
 mongod(+0x23B308D) [0x55f1ce1c608d]
 libpthread.so.0(+0x10330) [0x7f7baa644330]
 libc.so.6(gsignal+0x37) [0x7f7baa2a1c37]
 libc.so.6(abort+0x148) [0x7f7baa2a5028]
 mongod(_ZN5mongo22invariantFailedWithMsgEPKcS1_S1_j+0x0) [0x55f1cc7da61a]
 mongod(_ZN5mongo21WiredTigerRecordStoreC1EPNS_18WiredTigerKVEngineEPNS_16OperationContextENS0_6ParamsE+0x6E0) [0x55f1cccd2ae0]
 mongod(_ZN5mongo29StandardWiredTigerRecordStoreC1EPNS_18WiredTigerKVEngineEPNS_16OperationContextENS_21WiredTigerRecordStore6ParamsE+0xD3) [0x55f1cccd2d13]
 mongod(_ZN5mongo18WiredTigerKVEngine21getGroupedRecordStoreEPNS_16OperationContextENS_10StringDataES3_RKNS_17CollectionOptionsENS_8KVPrefixE+0x3E4) [0x55f1cccbfc94]
 mongod(_ZN5mongo26KVDatabaseCatalogEntryBase14initCollectionEPNS_16OperationContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb+0x54E) [0x55f1cc99c7ce]
 mongod(_ZN5mongo15KVStorageEngineC2EPNS_8KVEngineERKNS_22KVStorageEngineOptionsESt8functionIFSt10unique_ptrINS_26KVDatabaseCatalogEntryBaseESt14default_deleteIS8_EENS_10StringDataEPS0_EE+0xA06) [0x55f1cc996f06]
 mongod(+0xB7BEC6) [0x55f1cc98eec6]
 mongod(_ZN5mongo20ServiceContextMongoD29initializeGlobalStorageEngineEv+0x637) [0x55f1cc9be907]
 mongod(+0x95A68C) [0x55f1cc76d68c]
 mongod(_ZN5mongo11mongoDbMainEiPPcS1_+0x86C) [0x55f1cc855ffc]
 mongod(main+0x9) [0x55f1cc7dc739]
 libc.so.6(__libc_start_main+0xF5) [0x7f7baa28cf45]
 mongod(+0xA32A1F) [0x55f1cc845a1f]
-----  END BACKTRACE  -----

After this error, these is no simple way to bring up the server.



 Comments   
Comment by Githook User [ 07/Dec/18 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-37749 replSetResizeOplog command does not validate argument correctly

(cherry picked from commit 83328dadb7aba72fc9202c91d5715ab4a2d04fcb)
(cherry picked from commit 8b07e3e7242c5048eb847105fe30a9e3ef2bb88c)
Branch: v3.4
https://github.com/mongodb/mongo/commit/bdcf088d3c90a4fe6e9c4f23559a22e73117af45

Comment by Githook User [ 29/Oct/18 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-37749 replSetResizeOplog command does not validate argument correctly

(cherry picked from commit 83328dadb7aba72fc9202c91d5715ab4a2d04fcb)
Branch: v3.6
https://github.com/mongodb/mongo/commit/8b07e3e7242c5048eb847105fe30a9e3ef2bb88c

Comment by Githook User [ 29/Oct/18 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-37749 replSetResizeOplog command does not validate argument correctly

(cherry picked from commit 83328dadb7aba72fc9202c91d5715ab4a2d04fcb)
Branch: v4.0
https://github.com/mongodb/mongo/commit/d5ca994f52d77b0277aa328f0adadaf1e06cb881

Comment by Githook User [ 29/Oct/18 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-37749 replSetResizeOplog command does not validate argument correctly
Branch: master
https://github.com/mongodb/mongo/commit/83328dadb7aba72fc9202c91d5715ab4a2d04fcb

Generated at Thu Feb 08 04:46:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.