sorbet srb tc segfault

Input

https://github.com/will/sorbetsegfault

srb tc

Observed output

/Users/will/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sorbet-0.5.5585/bin/srb: 
  line 46: 58729 Segmentation fault: 11  "${sorbet}" "${args[@]}"

Expected behavior

not segfault


/t/sorbetseqf (master)> bundle info sorbet
  * sorbet (0.5.5585)
    Summary: A Typechecker for Ruby
    Homepage: https://sorbet.run
    Path: /Users/will/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/sorbet-0.5.5585
/t/sorbetseqf (master)> ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
Asked Jan 07 '22 23:01
avatar will
will

2 Answer:

getting segfault after switch to ruby 2.7.1 and sorbet update (platform MacOS)

bundle exec srb tc
/Users/koenhandekyn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sorbet-0.5.5756/bin/srb: line 46: 99280 Segmentation fault: 11  "${sorbet}" "${args[@]}"

  * sorbet (0.5.5756)
    Summary: A Typechecker for Ruby
    Homepage: https://sorbet.run
    Path: /Users/koenhandekyn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sorbet-0.5.5756

debug and backtrace

lldb ~/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sorbet-static-0.5.5756-universal-darwin-19/libexec/sorbet
(lldb) target create "/Users/koenhandekyn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sorbet-static-0.5.5756-universal-darwin-19/libexec/sorbet"
Current executable set to '/Users/koenhandekyn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sorbet-static-0.5.5756-universal-darwin-19/libexec/sorbet' (x86_64).
(lldb) run
Process 99441 launched: '/Users/koenhandekyn/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sorbet-static-0.5.5756-universal-darwin-19/libexec/sorbet' (x86_64)
Process 99441 stopped
* thread #3, name = 'typecheck', stop reason = EXC_BAD_ACCESS (code=1, address=0x28)
    frame #0: 0x000000010056a034 sorbet`sorbet::core::File::isStdlib() const + 4
sorbet`sorbet::core::File::isStdlib:
->  0x10056a034 <+4>:  movzbl 0x28(%rdi), %esi
    0x10056a038 <+8>:  testb  $0x1, %sil
    0x10056a03c <+12>: jne    0x10056a04a               ; <+26>
    0x10056a03e <+14>: addq   $0x28, %rdi
Target 0: (sorbet) stopped.
(lldb) bt
* thread #3, name = 'typecheck', stop reason = EXC_BAD_ACCESS (code=1, address=0x28)
  * frame #0: 0x000000010056a034 sorbet`sorbet::core::File::isStdlib() const + 4
    frame #1: 0x00000001002d8a26 sorbet`sorbet::definition_validator::ValidateWalk::preTransformMethodDef(sorbet::core::Context, sorbet::ast::TreePtr) + 150
    frame #2: 0x00000001002d6c6b sorbet`sorbet::ast::ShallowMapper<sorbet::definition_validator::ValidateWalk, sorbet::core::Context>::mapMethodDef(sorbet::ast::TreePtr, sorbet::core::Context) + 75
    frame #3: 0x00000001002d62a5 sorbet`sorbet::ast::ShallowMapper<sorbet::definition_validator::ValidateWalk, sorbet::core::Context>::mapIt(sorbet::ast::TreePtr, sorbet::core::Context) + 677
    frame #4: 0x00000001002d749b sorbet`sorbet::ast::ShallowMapper<sorbet::definition_validator::ValidateWalk, sorbet::core::Context>::mapClassDef(sorbet::ast::TreePtr, sorbet::core::Context) + 347
    frame #5: 0x00000001002d639d sorbet`sorbet::ast::ShallowMapper<sorbet::definition_validator::ValidateWalk, sorbet::core::Context>::mapIt(sorbet::ast::TreePtr, sorbet::core::Context) + 925
    frame #6: 0x00000001002d6f46 sorbet`sorbet::ast::ShallowMapper<sorbet::definition_validator::ValidateWalk, sorbet::core::Context>::mapInsSeq(sorbet::ast::TreePtr, sorbet::core::Context) + 182
    frame #7: 0x00000001002d62f5 sorbet`sorbet::ast::ShallowMapper<sorbet::definition_validator::ValidateWalk, sorbet::core::Context>::mapIt(sorbet::ast::TreePtr, sorbet::core::Context) + 757
    frame #8: 0x00000001002d749b sorbet`sorbet::ast::ShallowMapper<sorbet::definition_validator::ValidateWalk, sorbet::core::Context>::mapClassDef(sorbet::ast::TreePtr, sorbet::core::Context) + 347
    frame #9: 0x00000001002d639d sorbet`sorbet::ast::ShallowMapper<sorbet::definition_validator::ValidateWalk, sorbet::core::Context>::mapIt(sorbet::ast::TreePtr, sorbet::core::Context) + 925
    frame #10: 0x00000001002d6f46 sorbet`sorbet::ast::ShallowMapper<sorbet::definition_validator::ValidateWalk, sorbet::core::Context>::mapInsSeq(sorbet::ast::TreePtr, sorbet::core::Context) + 182
    frame #11: 0x00000001002d62f5 sorbet`sorbet::ast::ShallowMapper<sorbet::definition_validator::ValidateWalk, sorbet::core::Context>::mapIt(sorbet::ast::TreePtr, sorbet::core::Context) + 757
    frame #12: 0x00000001002d568c sorbet`sorbet::ast::TreePtr sorbet::ast::ShallowMap::apply<sorbet::core::Context, sorbet::definition_validator::ValidateWalk>(sorbet::core::Context, sorbet::definition_validator::ValidateWalk&, sorbet::ast::TreePtr) + 76
    frame #13: 0x00000001002d545b sorbet`sorbet::definition_validator::runOne(sorbet::core::Context, sorbet::ast::ParsedFile) + 155
    frame #14: 0x0000000100145379 sorbet`sorbet::realmain::pipeline::typecheckOne(sorbet::core::Context, sorbet::ast::ParsedFile, sorbet::realmain::options::Options const&) + 169
    frame #15: 0x000000010015cd6b sorbet`std::__1::__function::__func<sorbet::realmain::pipeline::typecheck(std::__1::unique_ptr<sorbet::core::GlobalState, std::__1::default_delete<sorbet::core::GlobalState> >&, std::__1::vector<sorbet::ast::ParsedFile, std::__1::allocator<sorbet::ast::ParsedFile> >, sorbet::realmain::options::Options const&, sorbet::WorkerPool&, bool, std::__1::optional<std::__1::shared_ptr<sorbet::core::lsp::PreemptionTaskManager> >)::$_4, std::__1::allocator<sorbet::realmain::pipeline::typecheck(std::__1::unique_ptr<sorbet::core::GlobalState, std::__1::default_delete<sorbet::core::GlobalState> >&, std::__1::vector<sorbet::ast::ParsedFile, std::__1::allocator<sorbet::ast::ParsedFile> >, sorbet::realmain::options::Options const&, sorbet::WorkerPool&, bool, std::__1::optional<std::__1::shared_ptr<sorbet::core::lsp::PreemptionTaskManager> >)::$_4>, void ()>::operator()() + 443
    frame #16: 0x00000001005ecd95 sorbet`std::__1::__function::__func<sorbet::WorkerPoolImpl::multiplexJob(std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::function<void ()>)::$_2, std::__1::allocator<sorbet::WorkerPoolImpl::multiplexJob(std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::function<void ()>)::$_2>, bool ()>::operator()() + 37
    frame #17: 0x00000001005ec36a sorbet`std::__1::__function::__func<sorbet::WorkerPoolImpl::WorkerPoolImpl(int, spdlog::logger&)::$_0, std::__1::allocator<sorbet::WorkerPoolImpl::WorkerPoolImpl(int, spdlog::logger&)::$_0>, void ()>::operator()() + 314
    frame #18: 0x00000001005edb64 sorbet`Joinable::trampoline(void*) + 68
    frame #19: 0x00007fff693a9109 libsystem_pthread.dylib`_pthread_start + 148
    frame #20: 0x00007fff693a4b8b libsystem_pthread.dylib`thread_start + 15
1
Answered Jun 17 '20 at 21:16
avatar  of koenhandekyn
koenhandekyn

Just realized I'd begun bundling for deployment. bundle exec srb tc --ignore=vendor/ fixed the issue for me. Sharing in case others find helpful.

1
Answered Jul 25 '20 at 20:49
avatar  of dduugg
dduugg