Shopify / packwerk

Good things come in small packages.
MIT License
1.54k stars 111 forks source link

[Bug Report] bundler: failed to load command: packwerk #360

Open mrcasals opened 1 year ago

mrcasals commented 1 year ago

Description After upgrading to Ruby 3.0, we started getting this kind of errors:

......................bundler: failed to load command: packwerk (/runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/bin/packwerk)
/runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/parallel-1.22.1/lib/parallel.rb:86:in `rescue in work': Parallel::DeadWorker (Parallel::DeadWorker)
    from /runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/parallel-1.22.1/lib/parallel.rb:83:in `work'
    from /runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/parallel-1.22.1/lib/parallel.rb:482:in `block (4 levels) in work_in_processes'
    from /runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/parallel-1.22.1/lib/parallel.rb:597:in `with_instrumentation'
    from /runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/parallel-1.22.1/lib/parallel.rb:481:in `block (3 levels) in work_in_processes'
    from /runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/parallel-1.22.1/lib/parallel.rb:469:in `loop'
    from /runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/parallel-1.22.1/lib/parallel.rb:469:in `block (2 levels) in work_in_processes'
    from /runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/parallel-1.22.1/lib/parallel.rb:222:in `block (4 levels) in in_threads'
/runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/marshal.rb:8:in `load': end of file reached (EOFError)
    from /runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.3/lib/active_support/core_ext/marshal.rb:8:in `load'
    from /runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/parallel-1.22.1/lib/parallel.rb:84:in `work'
    from /runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/parallel-1.22.1/lib/parallel.rb:482:in `block (4 levels) in work_in_processes'
    from /runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/parallel-1.22.1/lib/parallel.rb:597:in `with_instrumentation'
    from /runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/parallel-1.22.1/lib/parallel.rb:481:in `block (3 levels) in work_in_processes'
    from /runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/parallel-1.22.1/lib/parallel.rb:469:in `loop'
    from /runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/parallel-1.22.1/lib/parallel.rb:469:in `block (2 levels) in work_in_processes'
    from /runner/_work/app/app/backend/vendor/bundle/ruby/3.0.0/gems/parallel-1.22.1/lib/parallel.rb:222:in `block (4 levels) in in_threads'

It happens a bit randomly and we cannot debug it, but maybe you have some clues with the stacktrace. Packwerk runs for most of the app, but suddenly bundler says it cannot find the command and halts.

To me, Parallel::DeadWorker and the end of file reached (EOFError) lines seem to most relevant, but I don't have enough knowledge about packwerk internals to understand what might be the issue.

To Reproduce None, sadly :(

Expected Behaviour bundler should be able to find the command.

Screenshots If applicable, add screenshots to help explain your problem.

Version Information

Additional Context None

yesthesoup commented 7 months ago

This was happening in my project in the past as well, with bin/packwerk check and bin/packwerk validate crashing intermittently.

I worked around it by setting:

# packwerk.yml
parallel: false

in case anyone else is running into this, although I can't reproduce it now.