deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "marios@redhat.com" <mandr...@redhat.com>
Subject net/http issue?
Date Tue, 19 Apr 2011 14:59:48 GMT
Jayg came across an interesting issue which we talked about on irc 
#deltacloud last night... i've spent some more (than I should have for 
sure) time on it today and tracked it down to weirdness in net/http. I'm 
not convinced its a real problem but thought i'd post it here to see if 
anyone else has any thoughts about it.

Problem description/replication:

*start deltacloud when your network is down and try to (e.g.) get a list 
of images, obviously you get " (getaddrinfo: Name or service not known)".

*now while deltacloud still running, bring network back up, and try same 
request. You get the same result, i.e. " (getaddrinfo: Name or service 
not known)", even though the network is now up.

Weirdly, if your network is up when deltacloud starts you don't get 
this. In other words:

* start deltacloud as normal with your network up, make a request (which 
is successful),

* bring network down, make a request, request fails

* bring network back up, make a request, request successful again.


After much digging around, I've tracked it down to net/http 
Net::HTTP.connect (line 560 in /usr/lib/ruby/1.8/net/http.rb) where the 
TCPSocket is opened. Simple proof, try this in irb (make sure you use 
'irb -rubygems' cos we need to require net etc).

* Bring network down, open a terminal and do 'irb -rubygems', paste the 
following:

   require "net/http"
   require "uri"

   uri = URI.parse("http://incubator.apache.org/deltacloud/")
   http = Net::HTTP.new(uri.host, uri.port)
   request = Net::HTTP::Get.new(uri.request_uri)
   response = http.request(request)

*this will fail since network is down. Without exiting irb session, 
bring network up and try the code again, will still fail.


marios

Mime
View raw message