1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/lib/rails
Tawan Sierek 221b4aead5 Avoid multiple default paths to server.pid file
Fix bug (#22811) that occurs when rails server is started in daemon mode
and optional path to the `server.pid` file is omitted. Store default path
in a constant instead of evaluating it multiple time using `File.expand_path`.

The bug in detail: The server startup procedure crashes, since it tries to
open a file at `/tmp/pids/server.pid` instead of
`<path to project>/tmp/pids/server.pid`. This bug was introduced in 51211a94bd
when Rack was upgraded from version 1.x to 2.x. Since version 2.x,
Rack does not memoize the options hash [1], and as a consequence
`Rails::Server#default_options` will be evaluated multiple times.
The hash returned by `Rails::Server#default_options` holds the default path
to the `server.pid` file. The path is generated with the method
`File.expand_path`. However, the return value of this method depends on the
current working directory [2], which changes once `Process.daemon` is invoked
by `Rack::Server#daemonize_app` and the process is detached from the current
shell.

Close #22811

[1]https://git.io/vzen2
[2]http://ruby-doc.org/core-2.1.5/File.html#method-c-expand_path
2016-01-16 16:16:43 +01:00
..
api Generate API doc for actioncable 2015-12-17 16:04:46 +01:00
application Flexible configuration for ActionDispatch::SSL 2015-12-29 13:07:51 +00:00
commands Avoid multiple default paths to server.pid file 2016-01-16 16:16:43 +01:00
console Fix #21977: Removes memoization of helpers in Rails console 2015-10-16 19:28:38 -04:00
engine config.generators should be docummented since it is public API 2015-10-22 14:52:19 -02:00
generators Improve generated config initializer files 2016-01-13 12:45:55 +01:00
rack
railtie
tasks rake log:clear task updated refs[#22544] 2016-01-09 13:39:41 +05:30
templates Update the URL when changing mailer preview formats 2015-10-06 13:32:07 -07:00
test_unit bring back TEST env for rake test. 2016-01-12 19:26:05 +01:00
all.rb Doh, should have read ff370ee617 2015-12-16 15:52:46 +01:00
app_loader.rb
application.rb Accept a Pathname in Application#config_for 2015-12-15 15:53:53 -02:00
application_controller.rb
backtrace_cleaner.rb
cli.rb
code_statistics.rb Allow rake:stats to account for rake tasks 2015-10-19 10:36:30 -04:00
code_statistics_calculator.rb Allow rake:stats to account for rake tasks 2015-10-19 10:36:30 -04:00
command.rb Nodoc Rails command. 2015-12-13 20:22:38 +01:00
commands.rb Implement Rake proxy for Rails' command line interface. 2015-12-13 20:59:41 +01:00
configuration.rb
engine.rb Merge pull request #20986 from radar/rails-engine-caller-locations 2015-10-04 20:46:54 -04:00
gem_version.rb Change alpha to beta1 to prep for release of Rails 5 2015-12-18 12:14:09 -05:00
generators.rb do not show Active Job test generator 2015-11-14 16:39:48 +09:00
info.rb
info_controller.rb
initializable.rb
mailers_controller.rb Use Mime[:foo] instead of Mime::Type[:FOO] for back compat 2015-10-06 11:29:30 -07:00
paths.rb
rack.rb
railtie.rb
ruby_version_check.rb
source_annotation_extractor.rb
tasks.rb Add Rails command infrastructure and encapsulate development caching 2015-12-04 13:15:43 -05:00
test_help.rb
version.rb
welcome_controller.rb