gpt4 book ai didi

ruby-on-rails-4 - 本地服务器中的 puma 错误

转载 作者:行者123 更新时间:2023-12-04 07:04:43 25 4
gpt4 key购买 nike

我最近将 puma 添加到我的应用程序中,以便在 heroku 上获得更好的性能。我的应用程序在生产(实时)环境中运行良好,但我在本地环境中遇到错误。

当我尝试启动我的服务器时出错:

Art West@ARTWESTIV ~/desktop/drinkPGH (master)
$ rails s
=> Booting Puma
=> Rails 4.1.8 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
[11868] *** SIGUSR2 not implemented, signal based restart unavailable!
[11868] *** SIGUSR1 not implemented, signal based restart unavailable!
[11868] *** SIGHUP not implemented, signal based logs reopening unavailable!
[11868] Puma starting in cluster mode...
[11868] * Version 3.0.2 (ruby 2.1.5-p273), codename: Plethora of Penguin Pinatas
[11868] * Min threads: 5, max threads: 5
[11868] * Environment: development
[11868] * Process workers: 2
[11868] * Preloading application
[11868] * Listening on tcp://0.0.0.0:3000
Exiting
c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/puma-3.0.2/lib/puma/cluster.rb:320:in `trap': unsupported signal SIGCHLD (ArgumentError)
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/puma-3.0.2/lib/puma/cluster.rb:320:in `setup_signals'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/puma-3.0.2/lib/puma/cluster.rb:389:in `run'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/puma-3.0.2/lib/puma/launcher.rb:173:in `run'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/puma-3.0.2/lib/rack/handler/puma.rb:51:in `run'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.5.5/lib/rack/server.rb:264:in `start'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/server.rb:69:in `start'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:81:in `block in server'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76:in `tap'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76:in `server'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

和我的 gemfile:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use sqlite3 as the database for Active Record

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bootstrap-sass'


group :production do
gem 'pg'
gem 'rails_12factor'
gem 'puma'
end

group :development, :test do
gem 'sqlite3'

end

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]

我的配置.puma

workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'

on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
end

最佳答案

 workers Integer(ENV['WEB_CONCURRENCY'] || 2)

(不是修复)通过注释 config/puma.rb 的第 1 行,我能够在开发中运行 puma。

workers Integer(ENV['WEB_CONCURRENCY'] || 0) also works

关于ruby-on-rails-4 - 本地服务器中的 puma 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35735275/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com