1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/test
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
..
application bring back TEST env for rake test. 2016-01-12 19:26:05 +01:00
commands Avoid multiple default paths to server.pid file 2016-01-16 16:16:43 +01:00
configuration
fixtures
generators correctly presence check of application_record.rb in plugin 2016-01-02 14:44:50 +09:00
isolation run against edge sass to eliminate circular require warnings 2015-09-30 07:42:58 -07:00
railties Internal test migrations use the private 'Current' version 2015-12-15 17:18:09 +10:30
test_unit Add colored output to the new test reporter. 2015-12-22 10:58:05 -02:00
abstract_unit.rb
app_loader_test.rb
backtrace_cleaner_test.rb
code_statistics_calculator_test.rb Revert "Merge pull request #22569 from seuros/remove-test-case" 2015-12-13 21:24:40 -05:00
code_statistics_test.rb
engine_test.rb
env_helpers.rb
generators_test.rb
initializable_test.rb
path_generation_test.rb
paths_test.rb
rack_logger_test.rb
rails_info_controller_test.rb Revert "Merge pull request #22569 from seuros/remove-test-case" 2015-12-13 21:24:40 -05:00
rails_info_test.rb
version_test.rb