Early termination of worker puma log 是什么意思,为什么会这样?

What does Early termination of worker puma log mean and why is it happening?

对于我的 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

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]

好的,所以这需要进行大量调试,并且会遇到很多不同的问题。这个问题非常简单。我创建了一个 class,但我拼写错误并称之为 GetLitsingsResponse。将 class 改回 GetListingsResponse 后,Puma 在我的远程 AWS Elastic beanstalk 环境中工作得很好。这很奇怪,我的 Mac OS Puma 没有问题。但是在64bit Amazon Linux 2018.03 v2.11.4 运行 Ruby 2.6 (Puma) 平台Puma 无法正常运行。

我的问题是使用的 puma 补丁版本不同。

要点是 AWS Elastic Beanstalk 使用 puma 4.3.3 而我使用 puma 4.3.5.

必须将我的 Gemfile 中使用的 puma 版本修复为完全 4.3.3 以匹配 AWS Elastic Beanstalk 目前使用的堆栈以防止出现此错误。

有关类似问题的 this answer of mine here 中有更多详细信息。

如果您有 postgres 桌面应用程序,请遵循以下几点

  1. 打开它并打开服务器设置。
  2. 打开日志文件
  3. 单击菜单栏中的显示。
  4. 然后尝试在同一目录中搜索 postmaster.pid。
  5. 删除postmaster.pid.
  6. 在应用程序中重新启动您的 puma 服务器。
  7. 现在您的 rails 服务器可以正常工作了。

.