Weird DNS problem with net/http

  • Thread starter Zachary P. Landau
  • Start date
Z

Zachary P. Landau

--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 <[email protected]>
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--
 
Z

Zachary P. Landau

--j3olVFx0FsM75XyV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
=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 <[email protected]>
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--
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top