简体   繁体   English

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

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

For my Elastic Beanstalk instance, I am getting a 504 status code response whenever I visit it.对于我的 Elastic Beanstalk 实例,每当我访问它时都会收到504状态代码响应。 When I tail the logs I see the following log on the puma app server:当我跟踪日志时,我在 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

What does Early termination of worker mean and why is it happening? Early termination of worker什么意思,为什么会发生? Moreover, could the log be indicating the cause of my timeout error I am facing in my remote environment?此外,日志是否可以指示我在远程环境中面临的超时错误的原因? The rails app and puma run perfectly on my local machine (Mac OS Catalina 10.15). rails 应用程序和 puma 在我的本地机器(Mac OS Catalina 10.15)上完美运行。 However, in my remote Elastic beanstalk environment as stated above I am getting a timeout 504 error and the only thing I see in the logs is the above puma log.但是,在如上所述的远程 Elastic beanstalk 环境中,我收到超时 504 错误,我在日志中看到的唯一内容是上面的 puma 日志。

This is my 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]

The problem for my case was a difference in the patch version of the puma that was used.我的问题是使用的 puma 的补丁版本不同。

Gist of it was AWS Elastic Beanstalk was using puma 4.3.3 while I was using puma 4.3.5 .要点是 AWS Elastic Beanstalk 使用puma 4.3.3而我使用的是puma 4.3.5

Had to fix the version of puma used in my Gemfile to exactly 4.3.3 to match the stack used by AWS Elastic Beanstalk as of today prevent this error.必须将我的 Gemfile 中使用的puma版本修复为4.3.3以匹配 AWS Elastic Beanstalk 截至今天使用的堆栈,以防止出现此错误。

More details in this answer of mine here for a similar question.对于类似问题,我的这个答案中的更多详细信息。

Ok so this took a lot of debugging and going down a lot of different rabbit holes.好的,所以这需要大量的调试和很多不同的兔子洞。 The problem was very painfully simple.这个问题非常简单。 I created a class which I misspelled and called, GetLitsingsResponse .我创建了一个 class ,我拼错并称之为GetLitsingsResponse After changing the class back to GetListingsResponse Puma works just fine in my remote AWS Elastic beanstalk environment.将 class 更改回GetListingsResponse后,Puma 在我的远程 AWS Elastic beanstalk 环境中工作得很好。 It's very strange out locally on my Mac OS Puma had no problem.在我的 Mac OS 上本地很奇怪 Puma 没有问题。 But in the 64bit Amazon Linux 2018.03 v2.11.4 running Ruby 2.6 (Puma) platform Puma would not function normally.但是在运行 Ruby 2.6(Puma)平台的 64 位 Amazon Linux 2018.03 v2.11.4 中,Puma 不会正常运行 ZC1C425268E68385D1AB5074C17A9。

If you have postgres desktop application then follow the following points如果您有 postgres 桌面应用程序,请遵循以下几点

  1. open it and open server settings.打开它并打开服务器设置。
  2. open log file打开日志文件
  3. the click on Reveal which is present at menu bar.单击菜单栏中的“显示”。
  4. then try to search postmaster.pid in same directory.然后尝试在同一目录中搜索 postmaster.pid。
  5. delete postmaster.pid.删除 postmaster.pid。
  6. Restart your puma server in application.在应用程序中重新启动您的 puma 服务器。
  7. Now your rails server will work properly.现在您的 Rails 服务器将正常工作。

. .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM