Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-30694

Large legacy wire protocol messages cause crash in ServiceStateMachine

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.5.11
    • Component/s: Networking
    • None
    • Fully Compatible
    • ALL
    • Hide
      var st = new ShardingTest({shards: 1});
      
      var data15MB = 'x'.repeat(15 * 1024 * 1024);
      var inserts = [
              {ukey: 1, data: data15MB},
              {ukey: 2, data: data15MB},
              {ukey: -1, data: data15MB},
              {ukey: -2, data: data15MB}
      ];
      
      var mongosWithLegacyWrites = new Mongo(st.s0.name);
      mongosWithLegacyWrites.forceWriteMode('legacy');
      
      var testColl = mongosWithLegacyWrites.getCollection('TestDB.TestColl');
      assert.writeOK(testColl.insert(inserts));
      
      Show
      var st = new ShardingTest({shards: 1}); var data15MB = 'x' .repeat(15 * 1024 * 1024); var inserts = [ {ukey: 1, data: data15MB}, {ukey: 2, data: data15MB}, {ukey: -1, data: data15MB}, {ukey: -2, data: data15MB} ]; var mongosWithLegacyWrites = new Mongo(st.s0.name); mongosWithLegacyWrites.forceWriteMode( 'legacy' ); var testColl = mongosWithLegacyWrites.getCollection( 'TestDB.TestColl' ); assert .writeOK(testColl.insert(inserts));

      If a large (more than 48MB) wire protocol message is sent against the server it crashes with the following message:

      [js_test:bulk_insert] 2017-08-16T12:20:58.706-0400 s20016| 2017-08-16T12:20:58.706-0400 I NETWORK  [conn2] recv(): message msgLen 62914792 is invalid. Min 16 Max: 48000000
      [js_test:bulk_insert] 2017-08-16T12:20:58.706-0400 s20016| 2017-08-16T12:20:58.706-0400 F -        [conn2] Invariant failure !_inMessage.empty() src\mongo\transport\service_stat
      e_machine.cpp 297
      [js_test:bulk_insert] 2017-08-16T12:20:58.706-0400 s20016| 2017-08-16T12:20:58.706-0400 F -        [conn2]
      [js_test:bulk_insert] 2017-08-16T12:20:58.706-0400 s20016|
      [js_test:bulk_insert] 2017-08-16T12:20:58.707-0400 s20016| ***aborting after invariant() failure
      [js_test:bulk_insert] 2017-08-16T12:20:58.707-0400 s20016|
      [js_test:bulk_insert] 2017-08-16T12:20:58.707-0400 s20016|
      

            Assignee:
            sara.golemon@mongodb.com Sara Golemon
            Reporter:
            kaloian.manassiev@mongodb.com Kaloian Manassiev
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: