New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Starting rails 5 as a daemon #22811
Comments
I confirm what written above. And that switching back to Rails 4.2.5 makes the daemon server work. |
Hi, I can confirm this bug as well. I took the time and got to the root of the problem. I already created a PR (see above). ./bin/rails server -d -P /my_rails_project/tmp/pids/server.pid The bug in detail: The server startup procedure crashes, since it tries to |
Fix bug (rails#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 51211a9 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 rails#22811 [1]https://git.io/vzen2 [2]http://ruby-doc.org/core-2.1.5/File.html#method-c-expand_path
👍 |
I create new rails app and try to run it with
-d
optionOutput:
From log file:
When running without
-d
it works just fineThe text was updated successfully, but these errors were encountered: