ruby-on-rails 提前终止工人美洲狮日志意味着什么,为什么会发生?

hof1towb  于 2023-10-21  发布在  Ruby
关注(0)|答案(4)|浏览(124)

对于我的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日志。
这是我的gem文件:

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]
wswtfjt7

wswtfjt71#

我的情况下的问题是在所使用的彪马补丁版本的差异。
AWS Elastic Beanstalk使用puma 4.3.3,而我使用puma 4.3.5
必须将Gemfile中使用的puma版本修复为4.3.3,以匹配AWS Elastic Beanstalk使用的堆栈,以防止此错误。
this answer of mine here中的更多细节用于类似问题。

s4n0splo

s4n0splo2#

好吧,这需要大量的调试和去了很多不同的兔子洞。这个问题非常简单,令人痛苦。我创建了一个类,我拼错了,并称之为GetLitsingsResponse。将类更改回GetListingsResponse后,Puma在我的远程AWS Elastic beanstalk环境中运行良好。这是非常奇怪的本地在我的Mac OS美洲狮没有问题。但在64位Amazon Linux 2018.03 v2.11.4运行Ruby 2.6(Puma)平台时,Puma无法正常工作。

vhipe2zx

vhipe2zx3#

如果你有postgres桌面应用程序,那么遵循以下几点
1.打开它并打开服务器设置。
1.打开日志文件
1.点击菜单栏上的显示。
1.然后尝试在同一目录中搜索postmaster.pid。
1.删除postmaster.pid.
1.在应用程序中重新启动您的彪马服务器。
1.现在您的Rails服务器可以正常工作了。
.

hm2xizp9

hm2xizp94#

在我的例子中,Postgres服务器没有启动,ENV丢失。
它不会抛出正确的错误,而是以提前终止工人结束。
只要确保:

  • 您的数据库已启动并运行
  • 更新所有ENV

相关问题