Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when setting FFMPEG_BINARY to override ffmpeg binary path #28375

Closed
sebastianw opened this issue Dec 15, 2023 · 2 comments · Fixed by #30022
Closed

Crash when setting FFMPEG_BINARY to override ffmpeg binary path #28375

sebastianw opened this issue Dec 15, 2023 · 2 comments · Fixed by #30022
Labels
area/web interface Related to the Mastodon web interface bug Something isn't working status/confirmed This bug has been confirmed

Comments

@sebastianw
Copy link

Steps to reproduce the problem

  1. Set FFMPEG_BINARY=/opt/mastodon/.local/bin/ffmpeg in .env.production
  2. Restart mastodon-web.service

Expected behaviour

Mastodon using custom FFMPEG binary

Actual behaviour

mastodon-web service crashing

Detailed description

After restarting mastodon-web it crashes with this error:

bundle[4015134]: /opt/mastodon/live/config/initializers/ffmpeg.rb:4:in `<main>': uninitialized constant FFMPEG (NameError)
bundle[4015134]:   FFMPEG.ffmpeg_binary = ENV['FFMPEG_BINARY']
bundle[4015134]:   ^^^^^^
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/engine.rb:667:in `load'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/engine.rb:667:in `block in load_config_initializer'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.8/lib/active_support/notifications.rb:208:in `instrument'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/engine.rb:666:in `load_config_initializer'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/engine.rb:619:in `each'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/engine.rb:619:in `block in <class:Engine>'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/initializable.rb:32:in `instance_exec'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/initializable.rb:32:in `run'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/initializable.rb:61:in `block in run_initializers'
bundle[4015134]:         from /opt/mastodon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/tsort.rb:228:in `block in tsort_each'
bundle[4015134]:         from /opt/mastodon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
bundle[4015134]:         from /opt/mastodon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
bundle[4015134]:         from /opt/mastodon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/tsort.rb:431:in `each_strongly_connected_component_from'
bundle[4015134]:         from /opt/mastodon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/initializable.rb:50:in `each'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/initializable.rb:50:in `tsort_each_child'
bundle[4015134]:         from /opt/mastodon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/tsort.rb:415:in `call'
bundle[4015134]:         from /opt/mastodon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/tsort.rb:415:in `each_strongly_connected_component_from'
bundle[4015134]:         from /opt/mastodon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/tsort.rb:349:in `block in each_strongly_connected_component'
bundle[4015134]:         from /opt/mastodon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/tsort.rb:347:in `each'
bundle[4015134]:         from /opt/mastodon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/tsort.rb:347:in `call'
bundle[4015134]:         from /opt/mastodon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/tsort.rb:347:in `each_strongly_connected_component'
bundle[4015134]:         from /opt/mastodon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/tsort.rb:226:in `tsort_each'
bundle[4015134]:         from /opt/mastodon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/tsort.rb:205:in `tsort_each'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/initializable.rb:60:in `run_initializers'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/railties-7.0.8/lib/rails/application.rb:372:in `initialize!'
bundle[4015134]:         from /opt/mastodon/live/config/environment.rb:7:in `<top (required)>'
bundle[4015134]:         from <internal:/opt/mastodon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
bundle[4015134]:         from <internal:/opt/mastodon/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
bundle[4015134]:         from config.ru:5:in `block in <main>'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `eval'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:116:in `new_from_string'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:105:in `load_file'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/rack-2.2.8/lib/rack/builder.rb:66:in `parse_file'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/puma-6.3.1/lib/puma/configuration.rb:366:in `load_rackup'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/puma-6.3.1/lib/puma/configuration.rb:288:in `app'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/puma-6.3.1/lib/puma/runner.rb:158:in `load_and_bind'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/puma-6.3.1/lib/puma/cluster.rb:359:in `run'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/puma-6.3.1/lib/puma/launcher.rb:194:in `run'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/puma-6.3.1/lib/puma/cli.rb:75:in `run'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/puma-6.3.1/bin/puma:10:in `<top (required)>'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/bin/puma:25:in `load'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/bin/puma:25:in `<top (required)>'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `load'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `kernel_load'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:23:in `run'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:492:in `exec'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:34:in `dispatch'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:28:in `start'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.13/exe/bundle:45:in `block in <top (required)>'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.13/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
bundle[4015134]:         from /opt/mastodon/live/vendor/bundle/ruby/3.2.0/gems/bundler-2.4.13/exe/bundle:33:in `<top (required)>'
bundle[4015134]:         from /opt/mastodon/.rbenv/versions/3.2.2/bin/bundle:25:in `load'
bundle[4015134]:         from /opt/mastodon/.rbenv/versions/3.2.2/bin/bundle:25:in `<main>'

Mastodon instance

local test instance

Mastodon version

v4.2.3

Browser name and version

Any Browser

Operating system

Any OS

Technical details

It seems this was introduced with the refactor to fix #16136

@sebastianw sebastianw added area/web interface Related to the Mastodon web interface bug Something isn't working status/to triage This issue needs to be triaged labels Dec 15, 2023
@ClearlyClaire ClearlyClaire changed the title Overriding FFMPEG binary does not work Crash when setting FFMPEG_BINARY to override ffmpeg binary path Dec 19, 2023
@ClearlyClaire ClearlyClaire added status/confirmed This bug has been confirmed and removed status/to triage This issue needs to be triaged labels Dec 19, 2023
@ClearlyClaire
Copy link
Contributor

I can confirm the issue. I wasn't even aware of this environment variable, which was added a few years ago in #8855 but currently does not work, and probably hasn't worked for years.

Doing a quick overview, we use ffmpeg at least in those places:

  • lib/paperclip/image_extractor.rb
  • lib/paperclip/transcoder.rb
  • app/lib/video_metadata_extractor.rb

@timothyjrogers
Copy link
Contributor

Submitted a fix for this: #30022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/web interface Related to the Mastodon web interface bug Something isn't working status/confirmed This bug has been confirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants