工人 puma 日志的提前终止是什么意思,为什么会发生这种情况?

rob*_*rob 6 ruby-on-rails puma amazon-elastic-beanstalk

对于我的 Elastic Beanstalk 实例,504每当我访问它时都会收到状态代码响应。当我跟踪日志时,我会在 puma 应用服务器上看到以下日志:

==> /var/log/puma/puma.log <==
[27240] Early termination of worker
[27245] Early termination of worker
[27249] Early termination of worker
[27253] Early termination of worker
[27257] Early termination of worker
[27261] Early termination of worker
[27265] Early termination of worker
[27269] Early termination of worker
[27273] Early termination of worker
[27277] Early termination of worker
Run Code Online (Sandbox Code Playgroud)

是什么Early termination of worker意思,为什么会发生?此外,日志是否可以指出我在远程环境中面临的超时错误的原因?rails 应用程序和 puma 在我的本地机器上完美运行(Mac OS Catalina 10.15)。但是,在如上所述的远程 Elastic beanstalk 环境中,我收到超时 504 错误,并且我在日志中看到的唯一内容是上面的 puma 日志。

这是我的 gemfile:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.1'
# Use mysql as the database for Active Record
gem 'mysql2', '>= 0.4.4'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use haml view syntax
gem 'haml-rails'

# the main komponent gem is broken for Rails 6, see:
# https://github.com/komposable/komponent/issues/133
gem 'komponent', github: '0x2C6/komponent'
gem 'elasticsearch', '~> 6.2'
gem 'redis'

# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Active Storage variant
# gem 'image_processing', '~> 1.2'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'pry-rails'
  gem 'rspec-rails', '~> 3.9'
  gem 'dotenv-rails'
  gem 'awesome_print'
end

group :beta, :production do
  gem 'puma_worker_killer'
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
  gem 'spring-commands-rspec'
   # Avoid polling for changes (Windows)
  gem 'wdm', '>= 0.1.0', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
end

group :test do
  gem 'webmock'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Run Code Online (Sandbox Code Playgroud)

rob*_*rob 2

好吧,这需要大量的调试并深入很多不同的兔子洞。问题非常简单。我创建了一个拼写错误的类,并将其命名为GetLitsingsResponse. 将类更改回GetListingsResponsePuma 后,在我的远程 AWS Elastic beanstalk 环境中工作得很好。这很奇怪,在我的 Mac OS 本地 Puma 上没有问题。但在运行 Ruby 2.6 (Puma) 的 64 位 Amazon Linux 2018.03 v2.11.4 平台上 Puma 将无法正常运行。

  • 那会非常耗时,我不明白为什么我总是收到“提前终止工人”的消息。对我来说,审计整个代码不是一个选择,因为它太大了。服务器在开发模式下以及当 demoize 为 false 时运行良好。可能需要切换到其他版本的 puma 或寻找其他选项。 (2认同)