This project is archived and is in readonly mode.
rails server fails when the tmp dir is missing
-
Merrick
I'm having this same issue. Anyone find any resolve on it?
-
Merrick
=> Booting WEBrick => Rails 3.0.0.beta application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server Exiting
/opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:208:ininitialize': No such file or directory - tmp/pids/server.pid (Errno::ENOENT)from /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:208:in `open' from /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:208:in `write_pid' from /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:154:in `start' from /opt/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/commands/server.rb:49:in `start' from /opt/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:83:in `start' from /opt/local/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/commands.rb:39 from /Users/Merrick/Work/Arkitekt/Projects/Campaign Arkitekt/campaignarkitekt.com/script/rails:10:in `require' from /Users/Merrick/Work/Arkitekt/Projects/Campaign Arkitekt/campaignarkitekt.com/script/rails:10 -
Petros Amiridis
I am not sure it's the best way, but until the bug is resolved I do the following as a workaround:
I go to script/rails file and add the following lines right after the first two lines:
+require "fileutils" +FileUtils.mkdir_p 'tmp' +FileUtils.mkdir_p 'tmp/cache' +FileUtils.mkdir_p 'tmp/pids' +FileUtils.mkdir_p 'tmp/sessions' +FileUtils.mkdir_p 'tmp/sockets' -
José Valim
- Assigned user set to Yehuda Katz (wycats)
- Milestone cleared.
-
Ravinder Rana
Attached is a patch to fix the issue. Basically, what we need to do is create the "tmp" directories before
starting the server, the way it was done in rails 2.3.*There's no tests for this yet as i was not able to figure out where the existing test class for "railties/lib/rails/commands/server.rb" is :( let me know if it exist, i'll add the necessary tests.
-
José Valim
- State changed from new to open
- Assigned user changed from Yehuda Katz (wycats) to José Valim
Ravinder, thanks for the patch! Before applying it, I need to ask you to do two changes:
1) Can you please create the patch using git format-patch? This will keep you as patch author. More information in the contributors guide: https://rails.lighthouseapp.com/projects/8994/sending-patches
2) RAILS_ROOT is deprecated. So instead of:
File.join(RAILS_ROOT, 'tmp', dir_to_make)You could do:
Rails.root.join('tmp', dir_to_make)That's it. Unfortunately there are no tests for rails/commands/server.
-
Ravinder Rana
Creating a new patch as per Jose suggestions.
-
Repository
- State changed from open to resolved
(from [db28d407f76a790a31e27bf51560e23425dd6944]) Create tmp directories if required before starting server [#3907 rails server fails when the tmp dir is missing state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/db28d407f76a790a31e27bf51560e2... -
José Valim
Thanks for the patch Ravinder!
