今天早上我的Rails应用程序崩溃了,因为我的磁盘空间已满,因此mysql db无法再写入tmp文件了。我通过将mysql指向具有更多空间的分区上的tmpdir,重新启动mysql,重新启动Apache,我所有其他应用程序再次快乐地运行来修复此问题。但不是我的Rails应用程序。
我使用Apache,Passenger和Capistrano部署它。现在,在我修复了mysql / space问题之后,应用程序再次出现,但每当我向服务器发送POST请求时,它都会返回500内部服务器错误。我检查了Apache error_log,这就是它所说的:
[Tue Apr 03 12:19:41 2012] [error] [client 130.xx.x.xxx] Premature end of script headers: logout, referer: http://myrailsapp.com/customers
[ pid=8942 thr=47916460421888 file=ext/apache2/Hooks.cpp:817 time=2012-04-03 12:19:41.52 ]: The backend application (process 9139) did not send a valid HTTP response; instead, it sent nothing at all. It is possible that it has crashe
d; please check whether there are crashing bugs in this application.
[ pid=9139 thr=231420160 file=utils.rb:176 time=2012-04-03 12:19:41.053 ]: *** Exception Errno::ENOENT in application (No such file or directory - /tmp/RackRewindableInput20120403-9139-60boph.lock) (process 9139, thread #<Thread:0x00
00001b966200>):
from /usr/local/lib/ruby/1.9.1/tempfile.rb:342:in `rmdir'
from /usr/local/lib/ruby/1.9.1/tempfile.rb:342:in `rmdir'
from /usr/local/lib/ruby/1.9.1/tempfile.rb:334:in `ensure in locking'
from /usr/local/lib/ruby/1.9.1/tempfile.rb:334:in `locking'
from /usr/local/lib/ruby/1.9.1/tempfile.rb:144:in `block in initialize'
from /usr/local/lib/ruby/1.9.1/tmpdir.rb:133:in `create'
from /usr/local/lib/ruby/1.9.1/tempfile.rb:134:in `initialize'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/utils/rewindable_input.rb:86:in `new'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/utils/rewindable_input.rb:86:in `make_rewindable'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/utils/rewindable_input.rb:30:in `read'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.6/lib/rack/request.rb:183:in `POST'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.6/lib/rack/methodoverride.rb:15:in `call'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.6/lib/rack/runtime.rb:17:in `call'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.6/lib/rack/lock.rb:15:in `call'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-cache-1.1/lib/rack/cache/context.rb:132:in `forward'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-cache-1.1/lib/rack/cache/context.rb:139:in `pass'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-cache-1.1/lib/rack/cache/context.rb:151:in `invalidate'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-cache-1.1/lib/rack/cache/context.rb:70:in `call!'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-cache-1.1/lib/rack/cache/context.rb:50:in `call'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/engine.rb:456:in `call'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb:479:in `safe_fork'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:180:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
from <internal:prelude>:10:in `synchronize'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/helper-scripts/passenger-spawn-server:99:in `<main>'
[root@ngrl logs]#
[root@ngrl logs]# tail /etc/httpd/logs/error_log
from <internal:prelude>:10:in `synchronize'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/helper-scripts/passenger-spawn-server:99:in `<main>'
这是我尝试过的: 我重启Apache几次,然后通过在tmp下放置一个restart.txt文件重启rails应用程序。我还用cap部署重新部署了它,但似乎没有任何效果。我对使用Webrick部署的开发版本没有这个问题,Webrick具有完全相同的代码和与生产版本位于同一位置的数据库。这一定是乘客的问题。 GET请求工作正常,但不是POST或PUT。
任何想法?
答案 0 :(得分:0)
我想你可能还有其他空间问题。您是否确定您的rails应用程序仍有空间用于日志和tmp目录?