From: Shyouhei Urabe Date: 2011-05-25T14:13:01+09:00 Subject: [ruby-core:36449] [Backport87 - Backport #4236][Closed] zlib.c requires RB_GC_GUARD backport from 1.9 Issue #4236 has been updated by Shyouhei Urabe. Status changed from Assigned to Closed I think I have fixed this. ---------------------------------------- Backport #4236: zlib.c requires RB_GC_GUARD backport from 1.9 http://redmine.ruby-lang.org/issues/4236 Author: Aman Gupta Status: Closed Priority: Normal Assignee: Shyouhei Urabe Category: ext Target version: =begin This issue was fixed in 1.9 r28080 via this patch: http://redmine.ruby-lang.org/repositories/diff/ruby-19?rev=28080 But the issue also exists in 1.8 branch, so the same patch should be backported. To replicate:

 unless File.exists?("test.gz")
   File.open("test","w"){|f| f.write "helloworld "*1024 }
   `gzip test`
 end
 
 require 'zlib'
 
 class Zlib::GzipReader
   class << self
     alias new_orig new
     def new(*args)
      GC.stress=true
       new_orig(*args)
     ensure
      GC.stress=false
     end
   end
 end
 
 def parse_gzip(i=0)
   Zlib::GzipReader.new(File.open('test.gz','r'))
 end
 
 5.times do |i|
   parse_gzip
 end
 
$ ruby simple.rb simple.rb:13:in `initialize': not in gzip format (Zlib::GzipFile::Error) from simple.rb:13:in `new_orig' from simple.rb:13:in `new' from simple.rb:21:in `parse_gzip' from simple.rb:25 from simple.rb:24:in `times' from simple.rb:24 =end -- http://redmine.ruby-lang.org