Net/http segfault

ts decoux@moulon.inra.fr wrote:

/usr/lib/ruby/1.6/net/protocol.rb:785: [BUG] Segmentation fault
ruby 1.6.7 (2002-03-01) [i686-linux-gnu]

What is the stack frame when it crash ?

How do I find this?

I can’t reproduce the problem

pigeon% host www.comicprovider.com
www.comicprovider.com does not exist, try again
pigeon%

I’m sorry. I should have clarified that I took out the specific domain and
path information because I am having this trouble on various sites and it is
not predictable as to when it will happen. But mostly it has been hitting me
as I use various archives on www.ucomics.com, and only because they have
such extensive archives.

Sometimes it will download a few months worth, then crash. Sometimes only a
few weeks would get pulled before crashing. Sometimes I would start it, it
would go a bit, crash… I would restart it from the same place and it would
not crash where it had crashed before.

How do I find this?

run it under gdb, and when it crash, execute the command "bt"
(backtrace). I just want to know if it's a problem similar to
[ruby-talk:53792]

Guy Decoux

OK. Here is a functional script this time:

#!/usr/bin/ruby -w
require ‘net/http’

domain = “images.ucomics.com
path = “/comics/db/2002/db02”

‘01’.upto(‘12’) do |month|
start = ‘01’
finish = ‘31’

puts “Fetching #{path} from #{domain} starting at #{start} and going to
#{finish} for month #{month}”
h = Net::HTTP.new(domain, 80)

start.upto(finish) do |g|
begin
s = “#{path}#{month}#{g}.gif”
puts “Fetching #{s}…”
resp, data = h.get(s)
puts “Writing #{g}…”
File.open(“doonesbury_2002#{month}#{g}.gif”, “w+”){|b| b.puts data}
rescue
puts “error fetching or writing #{s}, continuing”
end
end

end

Here is how it looks in a gdb session:

ichimunki@greyhound:~/images/comics/doonesbury$ gdb ruby
GNU gdb 5.2.1
[snip]
(gdb) run doonfetch.rb
Starting program: /usr/bin/ruby doonfetch.rb
(no debugging symbols found)…(no debugging symbols found)…(no debugging
symbols found)…(no debugging symbols found)…
Fetching /comics/db/2002/db02 from images.ucomics.com starting at 01 and
going to 31 for month 01
Fetching /comics/db/2002/db020101.gif…
(no debugging symbols found)…(no debugging symbols found)…(no debugging
symbols found)…(no debugging symbols found)…
Writing 01…
Fetching /comics/db/2002/db020102.gif…
Writing 02…
Fetching /comics/db/2002/db020103.gif…
[snip]
Fetching /comics/db/2002/db020120.gif…
Writing 20…
Fetching /comics/db/2002/db020121.gif…
Writing 21…
Fetching /comics/db/2002/db020122.gif…
(no debugging symbols found)…
Program received signal SIGSEGV, Segmentation fault.
0x080aa2af in st_lookup ()
(gdb) bt
#0 0x080aa2af in st_lookup ()
#1 0x0805f696 in rb_throw ()
#2 0x0805836b in rb_stack_check ()
#3 0x080543a1 in rb_alias ()
#4 0x08053c36 in rb_alias ()
#5 0x0805446c in rb_alias ()
#6 0x08053d0a in rb_alias ()
#7 0x080529de in rb_alias ()
#8 0x08061d1e in rb_throw ()
#9 0x08058431 in rb_stack_check ()
#10 0x080543a1 in rb_alias ()
#11 0x08056ebd in rb_block_given_p ()
#12 0x08054b59 in rb_alias ()
#13 0x080529de in rb_alias ()
#14 0x08061d1e in rb_throw ()
#15 0x08058431 in rb_stack_check ()
#16 0x080543a1 in rb_alias ()
#17 0x080536fb in rb_alias ()
#18 0x08061d1e in rb_throw ()
#19 0x08058431 in rb_stack_check ()
#20 0x080543a1 in rb_alias ()
#21 0x080529de in rb_alias ()
#22 0x08061d1e in rb_throw ()
#23 0x08058431 in rb_stack_check ()
#24 0x080543a1 in rb_alias ()
#25 0x08061d1e in rb_throw ()
#26 0x08058431 in rb_stack_check ()
#27 0x080621f8 in rb_throw ()
#28 0x0806695a in rb_throw ()
#29 0x08061a76 in rb_throw ()
#30 0x08058431 in rb_stack_check ()
#31 0x080543a1 in rb_alias ()
#32 0x080529de in rb_alias ()
#33 0x08061d1e in rb_throw ()
#34 0x08058431 in rb_stack_check ()
#35 0x080543a1 in rb_alias ()
#36 0x0805ae02 in rb_f_lambda ()
#37 0x08055346 in rb_alias ()
#38 0x08054adf in rb_alias ()
#39 0x08056ebd in rb_block_given_p ()
#40 0x08054b59 in rb_alias ()
#41 0x08054adf in rb_alias ()
#42 0x08053b5e in rb_alias ()
#43 0x080529de in rb_alias ()
#44 0x08061d1e in rb_throw ()
#45 0x08058431 in rb_stack_check ()
#46 0x080543a1 in rb_alias ()
#47 0x080536fb in rb_alias ()

  • —Type to continue, or q to quit—
    #48 0x080529de in rb_alias ()
    #49 0x08061d1e in rb_throw ()
    #50 0x08058431 in rb_stack_check ()
    #51 0x080543a1 in rb_alias ()
    #52 0x080536fb in rb_alias ()
    #53 0x080529de in rb_alias ()
    #54 0x08061d1e in rb_throw ()
    #55 0x08058431 in rb_stack_check ()
    #56 0x080543a1 in rb_alias ()
    #57 0x08053bf5 in rb_alias ()
    #58 0x080529de in rb_alias ()
    #59 0x08053a76 in rb_alias ()
    #60 0x08056ebd in rb_block_given_p ()
    #61 0x0805e939 in rb_yield ()
    #62 0x080ae33e in rb_str_upto ()
    #63 0x080af1e0 in rb_str_setter ()
    #64 0x08066942 in rb_throw ()
    #65 0x08061a76 in rb_throw ()
    #66 0x08058431 in rb_stack_check ()
    #67 0x080543a1 in rb_alias ()
    #68 0x080536fb in rb_alias ()
    #69 0x08056ebd in rb_block_given_p ()
    #70 0x0805e939 in rb_yield ()
    #71 0x080ae33e in rb_str_upto ()
    #72 0x080af1e0 in rb_str_setter ()
    #73 0x08066942 in rb_throw ()
    #74 0x08061a76 in rb_throw ()
    #75 0x08058431 in rb_stack_check ()
    #76 0x080543a1 in rb_alias ()
    #77 0x080536fb in rb_alias ()
    #78 0x080511ce in ruby_run ()
    #79 0x08050925 in main ()
    #80 0x40096142 in __libc_start_main () from /lib/libc.so.6
    (gdb)

And ruby -v for good measure. :slight_smile:

ichimunki@greyhound:~/images/comics/doonesbury$ ruby -v
ruby 1.6.7 (2002-03-01) [i686-linux-gnu]

Thanks,
-michael

Michael C. Libby x@ichimunki.com http://www.ichimunki.com/ http://www.ichimunki.com/public_key.txt
···

On Wednesday 30 October 2002 02:58, ts wrote:

How do I find this?

run it under gdb, and when it crash, execute the command “bt”
(backtrace). I just want to know if it’s a problem similar to
[ruby-talk:53792]

ichimunki@greyhound:~/images/comics/doonesbury$ ruby -v
ruby 1.6.7 (2002-03-01) [i686-linux-gnu]

I can't reproduce the bug with this version

Apparently for the stack trace

gsub(/rb_alias/, 'rb_eval')
gsub(/rb_block_given_p/, 'rb_yield_0')
gsub(/rb_stack_check/, 'rb_call')
gsub(/rb_throw/, 'rb_call0|call_cfunc')
gsub(/rb_f_lambda/, 'block_pass')
gsub(/rb_str_setter/, 'rb_str_upto_m')

Difficult to use as it is

This is a pre-compiled version of ruby ?

Guy Decoux

ichimunki@greyhound:~/images/comics/doonesbury$ ruby -v
ruby 1.6.7 (2002-03-01) [i686-linux-gnu]

I can’t reproduce the bug with this version

[snip]

This is a pre-compiled version of ruby ?

No. It’s custom-compiled as part of Gentoo Linux 1.4 (gcc 3.2, GNU
libc2.2.2) compiled with maximum optimization and the Athlon XP switch
turned on. Should I assume this is the problem and recompile with some
different switches?

-michael

···

On Wednesday 30 October 2002 09:01, ts wrote:

No. It's custom-compiled as part of Gentoo Linux 1.4 (gcc 3.2, GNU
libc2.2.2) compiled with maximum optimization and the Athlon XP switch
turned on. Should I assume this is the problem and recompile with some
different switches?

yes,

Guy Decoux