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

Autocomplete segfaults in SpiderMonkey builds

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Shell
    • None
    • ALL

      Instead of listing completion possibilities, a second or third tab in the shell segfaults. The code appears to be executing the index number of a cached ShellAutocomplete() function.

      Typing "abc<tab><tab>" will trigger this in a fresh shell:

      $ ./mongo --nodb
      MongoDB shell version: 2.4.0-rc2-pre-
      > abcThu Feb 28 12:12:28.258 mongo got signal 11 (Segmentation fault), stack trace: 
      
      Thu Feb 28 12:12:28.262 0x6d1e83 0x5b2de7 0x7ff4674ea4a0 0x7357ab 0x68c3e2 0x68f1f9 0x67c4cc 0x5bdbd5 0x5b253d 0x5b27c1 0x5e1d0e 0x5e37ea 0x5e62c0 0x5b2cc9 0x5b70c1 0x5b897b 0x7ff4674d576d 0x5b2379 
       ./mongo(_ZN5mongo15printStackTraceERSo+0x27) [0x6d1e83]
       ./mongo(_Z12quitAbruptlyi+0xe8) [0x5b2de7]
       /lib/x86_64-linux-gnu/libc.so.6(+0x364a0) [0x7ff4674ea4a0]
       ./mongo(JS_CallFunction+0x23) [0x7357ab]
       ./mongo(_ZN5mongo12spidermonkey7SMScope6invokeEP10JSFunctionPKNS_7BSONObjES6_ibbb+0x2ba) [0x68c3e2]
       ./mongo(_ZN5mongo12spidermonkey7SMScope6invokeEyPKNS_7BSONObjES4_ibbb+0x63) [0x68f1f9]
       ./mongo(_ZN5mongo5Scope6invokeEPKcPKNS_7BSONObjES5_i+0xa2) [0x67c4cc]
       ./mongo(_ZN5mongo5Scope10invokeSafeEPKcPKNS_7BSONObjES5_i+0x3b) [0x5bdbd5]
       ./mongo(_Z19generateCompletionsRKSsRSt6vectorISsSaISsEE+0x109) [0x5b253d]
       ./mongo(_Z14completionHookPKcP20linenoiseCompletions+0x53) [0x5b27c1]
       ./mongo(_ZN11InputBuffer12completeLineER10PromptBase+0xfc) [0x5e1d0e]
       ./mongo(_ZN11InputBuffer12getInputLineER10PromptBase+0x2b2) [0x5e37ea]
       ./mongo(_Z9linenoisePKc+0x333) [0x5e62c0]
       ./mongo(_Z13shellReadlinePKci+0x22) [0x5b2cc9]
       ./mongo(_Z5_mainiPPcS0_+0x1fb0) [0x5b70c1]
       ./mongo(main+0x81) [0x5b897b]
       /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7ff4674d576d]
       ./mongo() [0x5b2379]
      

      Same thing on Windows:

      MongoDB shell version: 2.4.0-rc2-pre-
      > abcThu Feb 28 12:14:42.750 mongo got signal 11 (SIGSEGV), stack trace:
      
      Thu Feb 28 12:14:43.446 mongo.exe  ...\src\mongo\util\stacktrace.cpp(189)                       mongo::printStackTrace+0x5b
      Thu Feb 28 12:14:43.461 mongo.exe  ...\src\mongo\shell\dbshell.cpp(217)                         quitAbruptly+0x135
      Thu Feb 28 12:14:43.461 mongo.exe  f:\dd\vctools\crt_bld\self_64_amd64\crt\src\winxfltr.c(372)  _XcptFilter+0x283
      Thu Feb 28 12:14:43.461 mongo.exe  f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crt0.c(287)      __tmainCRTStartup$filt$0+0x28
      Thu Feb 28 12:14:43.477 mongo.exe                                                               __C_specific_handler+0x160
      Thu Feb 28 12:14:43.477 ntdll.dll                                                               RtlDecodePointer+0xbd
      Thu Feb 28 12:14:43.493 ntdll.dll                                                               RtlUnwindEx+0xbbf
      Thu Feb 28 12:14:43.493 ntdll.dll                                                               KiUserExceptionDispatcher+0x2e
      Thu Feb 28 12:14:43.508 mongo.exe  ...\src\third_party\js-1.7\jsapi.c(4310)                     JS_CallFunction+0x57
      Thu Feb 28 12:14:43.524 mongo.exe  ...\src\mongo\scripting\engine_spidermonkey.cpp(1709)        mongo::spidermonkey::SMScope::invoke+0x370
      Thu Feb 28 12:14:43.524 mongo.exe  ...\src\mongo\scripting\engine_spidermonkey_internal.h(282)  mongo::spidermonkey::SMScope::invoke+0x6f
      Thu Feb 28 12:14:43.539 mongo.exe  ...\src\mongo\scripting\engine.cpp(93)                       mongo::Scope::invoke+0xb6
      Thu Feb 28 12:14:43.555 mongo.exe  ...\src\mongo\scripting\engine.h(104)                        mongo::Scope::invokeSafe+0x81
      Thu Feb 28 12:14:43.555 mongo.exe  ...\src\mongo\shell\dbshell.cpp(79)                          generateCompletions+0x17f
      Thu Feb 28 12:14:43.571 mongo.exe  ...\src\mongo\shell\dbshell.cpp(96)                          completionHook+0x74
      Thu Feb 28 12:14:43.586 mongo.exe  ...\src\mongo\shell\linenoise.cpp(1375)                      InputBuffer::completeLine+0x101
      Thu Feb 28 12:14:43.586 mongo.exe  ...\src\mongo\shell\linenoise.cpp(1929)                      InputBuffer::getInputLine+0x272
      Thu Feb 28 12:14:43.602 mongo.exe  ...\src\mongo\shell\linenoise.cpp(2528)                      linenoise+0x3b1
      Thu Feb 28 12:14:43.618 mongo.exe  ...\src\mongo\shell\dbshell.cpp(187)                         shellReadline+0x33
      Thu Feb 28 12:14:43.618 mongo.exe  ...\src\mongo\shell\dbshell.cpp(941)                         _main+0x261f
      

            Assignee:
            tad Tad Marshall
            Reporter:
            tad Tad Marshall
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: