Ruby 1.9.1-p234, Passenger 2.2.5, Rails 2.3-stable closed stream on POST request

放肆的年华 提交于 2019-12-04 04:40:42

There is a workaround in passenger 2.2.8 so this is no longer needed.

Casual Jim's response above worked for me. Thanks very much Jim for your help.

The diffs on my system are, respectively, as follows. I hope this is helpful.

Killian.

*** /usr/local/lib/ruby/gems/1.9.1/gems/passenger-2.2.5/lib/phusion_passenger/utils.rb.orig Tue Nov  3 17:43:30 2009
--- /usr/local/lib/ruby/gems/1.9.1/gems/passenger-2.2.5/lib/phusion_passenger/utils.rb  Tue Nov  3 17:43:46 2009
***************
*** 31,36 ****
--- 31,37 ----
  require 'etc'
  require 'fcntl'
  require 'tempfile'
+ require 'stringio'
  require 'phusion_passenger/exceptions'
  if !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby"
    require 'phusion_passenger/native_support'


*** /usr/local/lib/ruby/1.9.1/tempfile.rb.orig  Tue Nov  3 17:44:34 2009
--- /usr/local/lib/ruby/1.9.1/tempfile.rb   Tue Nov  3 17:45:55 2009
***************
*** 137,143 ****
      # keep this order for thread safeness
      begin
        if File.exist?(@tmpname)
!         closed? or close
          File.unlink(@tmpname)
        end
        @@cleanlist.delete(@tmpname)
--- 137,143 ----
      # keep this order for thread safeness
      begin
        if File.exist?(@tmpname)
!         # closed? or close
          File.unlink(@tmpname)
        end
        @@cleanlist.delete(@tmpname)

I had to do the following to make it work

gems/passenger-2.2.5/lib/phusion_passenger/utils.rb add require 'stringio' to that file on line 34

open lib/ruby/1.9.1/tempfile.rb comment out line 140

And it works like a charm.

Hey Damien. I had the same problem and whilst i havent got an exact answer/link for you from memory i had to patch rack and not tempfile. I hope this helps

Casual Jim's fix worked for me, thanks, this problem was driving me nuts.

I also had to patch actionview (per hector gomez's patch at https://rails.lighthouseapp.com/projects/8994/tickets/2188-i18n-fails-with-multibyte-strings-in-ruby-19-similar-to-2038) to get rails and ruby 1.9.1 working.

When applying this fix, I cannot restart the Passenger module more than a few time using the tmp/restart.txt method. After that, requests are accepted but never served. I suspect that the patch may be leaking tempfiles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!