Passenger RequestHandler的客户端套接字中的异常RuntimeError(无法修改字符串;暂时锁定)

时间:2015-09-09 09:51:25

标签: ruby-on-rails sockets exception nginx

在nginx上托管的rails应用程序上接收以下错误:

Sending 502 response: application did not send a complete response
App 1462 stderr: [ 2015-xx-xx 15:10:29.2082 1494/XXXXXXXXXXXX(Worker 1) utils.rb:85 ]: *** Exception RuntimeError in Passenger RequestHandler's client socket (can't modify string; temporarily locked) (process 1494, thread XXXXXXXXXXXXX(Worker 1)):

App 1462 stderr:    from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-5.0.13/lib/phusion_passenger/utils/unseekable_socket.rb:188:in `read'
App 1462 stderr:    from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-5.0.13/lib/phusion_passenger/utils/unseekable_socket.rb:188:in `read'
[ 2015-09-09 15:10:29.2083 1423/7fa8af7fe700 age/Cor/Req/Utils.cpp:95 ]: [Client 6-19] Sending 502 response: application did not send a complete response
App 1462 stderr:    from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-5.0.13/lib/phusion_passenger/message_channel.rb:177:in `read_scalar'
App 1462 stderr:    from /usr/local/lib/ruby/gems/1.9.1/gems/passenger-5.0.13/lib/phusion_passenger/request_handler/thread_handler.rb:217:in `parse_session_request'
App 1462 stderr:    from /usr/local/lib/ruby/gems/1.9.1/gems/passenger

重新启动虚拟机和应用程序,但收到同样的错误。

1 个答案:

答案 0 :(得分:0)

不确定究竟是什么原因导致此错误。但是可以从这个链接中找到:

http://code.google.com/p/phusion-passenger/issues/detail?id=582

  

出于性能原因,我们一遍又一遍地重复使用相同的缓冲区来接收请求数据。如果你的应用程序能够以某种方式使用我们的缓冲区来接收I / O数据,那么在另一个线程中,这将导致竞争条件,结果是报告错误。

一位用户在此报告解决类似问题:

http://code.google.com/p/phusion-passenger/issues/detail?id=605

  

确实,我已将其缩小到rails-master和/或rack-cache 1.0。从最新版本的rails中删除缓存(因此它不会加载机架缓存)一切正常。

希望它会有所帮助