From: michael libby Date: 2002-10-30T22:09:59+09:00 Subject: Re: net/http segfault -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday 30 October 2002 02:58, ts wrote: > >>>>> "m" == michael libby writes: > > m> 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] 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. :) 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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9v9ng4ClW9KMwqnMRAsbsAJ4tpeO0/jKa0Pq/03ltBHy+Vv8kAQCgicj1 Wz7SFFLaQVXElzb1EUXkYqU= =cDlq -----END PGP SIGNATURE-----