Weird DNS problem with net/http

Discussion in 'Ruby' started by Zachary P. Landau, Jun 9, 2004.

  1. --tEFtbjk+mNEviIIX
    Content-Type: text/plain; charset=us-ascii
    Content-Disposition: inline
    Content-Transfer-Encoding: quoted-printable


    Hello,

    I'm running into a very strange problem with net/http. Or I should say,
    someone using my software is. My program downloads information from
    webpages using net/http. The person running into the problem is able to
    get information from most pages. One of those places is 'allmusic.com'.
    But when the program tries to download from 'image.allmusic.com',
    net/http always times out. He investigated further and found that it
    was failing on the DNS lookup. But if he runs nslookup on
    image.allmusic.com from the same machine, he gets the correct response. =20

    I am completely at a loss as to why net/http would be able to connect to
    every site except this one. It can even connect to the parent domain,
    but not the subdomain. Normally I would think this would be a problem
    with the person's machine, but he can connect to image.allmusic.com
    normally, just not through net/http.

    Here is the script I had him test with:

    require 'net/http'

    response =3D nil
    Net::HTTP.start("image.allmusic.com") do |http|
    response =3D http.get('/00/amg/pic200_web/drp000/p012/p01265m82m9.jpg')
    end

    if response.body.nil?
    puts "no "
    else
    puts "data received (saved as test.img)"
    File.open('test.img', 'w') { |f| f.write(response.body) }
    end

    And here is the output he gets:

    >ruby -w test_images2.rb

    /usr/local/lib/ruby/1.8/timeout.rb:42:in `new': execution expired
    (Timeout::Error)
    from /usr/local/lib/ruby/1.8/net/protocol.rb:83:in `connect'
    from /usr/local/lib/ruby/1.8/net/protocol.rb:82:in `timeout'
    from /usr/local/lib/ruby/1.8/timeout.rb:55:in `timeout'
    from /usr/local/lib/ruby/1.8/net/protocol.rb:82:in `connect'
    from /usr/local/lib/ruby/1.8/net/protocol.rb:64:in
    `initialize'
    from /usr/local/lib/ruby/1.8/net/http.rb:430:in `open'
    from /usr/local/lib/ruby/1.8/net/http.rb:430:in `do_start'
    from /usr/local/lib/ruby/1.8/net/http.rb:419:in `start'
    from /usr/local/lib/ruby/1.8/net/http.rb:324:in `start'
    =20
    Here's the information he gave me which may or may not be relevant:

    ruby 1.8.1 (2003-12-25) [i686-linux]
    Glibc 2.1.3
    Linux kernel 2.6.5
    No distribution (built machine from source)

    I realize this may be difficult for people to help with, since it will
    probably be hard to reproduce, but if you have any ideas, let me know.

    --
    Zachary P. Landau <>
    GPG: gpg --recv-key 0x24E5AD99 | http://kapheine.hypa.net/kapheine.asc

    --tEFtbjk+mNEviIIX
    Content-Type: application/pgp-signature
    Content-Disposition: inline

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.4 (GNU/Linux)

    iD8DBQFAxwjaCwWyMCTlrZkRAr88AJ445PA8KtDKjREzuBGZG3ncafZqyACdG+KJ
    zaYYLFpv3JMCxf1Rcxm8N54=
    =8D+v
    -----END PGP SIGNATURE-----

    --tEFtbjk+mNEviIIX--
     
    Zachary P. Landau, Jun 9, 2004
    #1
    1. Advertising

  2. --j3olVFx0FsM75XyV
    Content-Type: text/plain; charset=us-ascii
    Content-Disposition: inline
    Content-Transfer-Encoding: quoted-printable

    > > I realize this may be difficult for people to help with, since it will
    > > probably be hard to reproduce, but if you have any ideas, let me know.

    >=20
    > I think I remember a thread about DNS problems with ipv6 involeved. Maybe
    > you can dig that up on ruby-talk:
    > http://blade.nagaokaut.ac.jp/ruby/ruby-talk/index.shtml


    Thanks for the link. That problem looked very similar, but it turned out
    that the problem was somewhere else. But that thing did help identify
    another host with the same problem (ad.doubleclick.net). =20
    Apparently the user's DNS server is messed up somehow and for these
    sites, it was blocking out. The DNS lookup would timeout after 30 seconds,=
    but so
    would net/http, so it would stop trying to download the page right as
    DNS timeout out. The solution was to increase the timeout period.

    --
    Zachary P. Landau <>
    GPG: gpg --recv-key 0x24E5AD99 | http://kapheine.hypa.net/kapheine.asc

    --j3olVFx0FsM75XyV
    Content-Type: application/pgp-signature
    Content-Disposition: inline

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.4 (GNU/Linux)

    iD8DBQFAx+AKCwWyMCTlrZkRArnnAJ9WDDhP3R7pZgEsNyptwytlPMEGBACffZZi
    afmduhnVC/s2vY2pslDp3js=
    =YaV8
    -----END PGP SIGNATURE-----

    --j3olVFx0FsM75XyV--
     
    Zachary P. Landau, Jun 10, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dorayme
    Replies:
    1
    Views:
    650
    richard
    Jan 21, 2011
  2. Marlene A. Roman
    Replies:
    0
    Views:
    158
    Marlene A. Roman
    Jul 29, 2003
  3. Sam Roberts
    Replies:
    0
    Views:
    245
    Sam Roberts
    Mar 20, 2005
  4. will
    Replies:
    6
    Views:
    439
    Phrogz
    Dec 27, 2006
  5. gavino
    Replies:
    2
    Views:
    190
    Ted Zlatanov
    Jul 27, 2006
Loading...

Share This Page