Bill Horsman
2008-Oct-20 15:36 UTC
"Temporary failure in name resolution" for requests but not from console
Hello, I''ve been banging my head against this problem for a while now. I''m using Net::HTTP.get(URI.parse(url)) to fetch a response from another server. It looks like this: module Hxml def self.fetch // Not really using bbc.co.uk but it behaves the same when I do return Net::HTTP.get(URI.parse(''http://news.bbc.co.uk'')) end end I call that from my controller on my staging box (using an HTTP request, like normal) and it says "getaddrinfo: Temporary failure in name resolution". Fair enough, but it does work from the console on the staging box. In other words, from Mongrel I get an error, but from the console it works fine. The error''s backtrace points directly to the line above, "Net::HTTP.get". Now, the staging server is behind a firewall that I don''t know much about - and I can''t rule out that being the cause of the problem. Only, how would it work from the console if that was the case? As a double check, curl also works from a terminal too. It all works fine on my development box (Mongrel or console) - which just adds to the puzzle. I would have thought that the console environment was identical to the mongrel environment. When I start up the console it reports that is "Loading stage environment". And I can see mongrel running using ps and it includes "-e stage" so I''m pretty sure the environments are the same. Running Ruby 1.8.6 on Rails 2.1.0, Mac OS X Server 10.5.4 Thanks. - Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Bill Horsman
2008-Oct-22 08:10 UTC
Re: "Temporary failure in name resolution" for requests but not from console
Follow up from OP: On a suggestion by Rick Tessner, I switched from using Net:HTTP to a simple system call to curl. Same result :( It works fine from the console but curl returns false when called from Mongrel. It definitely looks like Mongrel is messing things up for me. It seems a little over the top to switch from Mongrel to something else (like Passenger?) just because of this. Note, using an IP address works fine in tests - but the URL I need to use needs the domain so that it can resolve its virtual hosts. - Bill On Oct 20, 4:36 pm, Bill Horsman <bill.hors...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > > I''ve been banging my head against this problem for a while now. I''m > using Net::HTTP.get(URI.parse(url)) to fetch a response from another > server. It looks like this: > > module Hxml > def self.fetch > // Not really using bbc.co.uk but it behaves the same when I do > return Net::HTTP.get(URI.parse(''http://news.bbc.co.uk'')) > end > end > > I call that from my controller on my staging box (using an HTTP > request, like normal) and it says "getaddrinfo: Temporary failure in > name resolution". Fair enough, but it does work from the console on > the staging box. In other words, from Mongrel I get an error, but from > the console it works fine. The error''s backtrace points directly to > the line above, "Net::HTTP.get". > > Now, the staging server is behind a firewall that I don''t know much > about - and I can''t rule out that being the cause of the problem. > Only, how would it work from the console if that was the case? As a > double check, curl also works from a terminal too. > > It all works fine on my development box (Mongrel or console) - which > just adds to the puzzle. > > I would have thought that the console environment was identical to the > mongrel environment. When I start up the console it reports that is > "Loading stage environment". And I can see mongrel running using ps > and it includes "-e stage" so I''m pretty sure the environments are the > same. > > Running Ruby 1.8.6 on Rails 2.1.0, Mac OS X Server 10.5.4 > > Thanks. > > - > Bill--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Bill Horsman
2008-Oct-22 11:08 UTC
Re: "Temporary failure in name resolution" for requests but not from console
Another follow up from OP: For the record, switching to Passenger fixed the problem. I''m happy to stick with Passenger so that''s fine. It looks like it''s definitely a Mongrel problem so I''ll stop by the Mongrel people to investigate further. Thanks for listening ;-) - Bill On Oct 22, 9:10 am, Bill Horsman <bill.hors...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Follow up from OP: > > On a suggestion by Rick Tessner, I switched from using Net:HTTP to a > simple system call to curl. Same result :( It works fine from the > console but curl returns false when called from Mongrel. It definitely > looks like Mongrel is messing things up for me. It seems a little over > the top to switch from Mongrel to something else (like Passenger?) > just because of this. > > Note, using an IP address works fine in tests - but the URL I need to > use needs the domain so that it can resolve its virtual hosts. > > - > Bill > > On Oct 20, 4:36 pm, Bill Horsman <bill.hors...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello, > > > I''ve been banging my head against this problem for a while now. I''m > > using Net::HTTP.get(URI.parse(url)) to fetch a response from another > > server. It looks like this: > > > module Hxml > > def self.fetch > > // Not really using bbc.co.uk but it behaves the same when I do > > return Net::HTTP.get(URI.parse(''http://news.bbc.co.uk'')) > > end > > end > > > I call that from my controller on my staging box (using an HTTP > > request, like normal) and it says "getaddrinfo: Temporary failure in > > name resolution". Fair enough, but it does work from the console on > > the staging box. In other words, from Mongrel I get an error, but from > > the console it works fine. The error''s backtrace points directly to > > the line above, "Net::HTTP.get". > > > Now, the staging server is behind a firewall that I don''t know much > > about - and I can''t rule out that being the cause of the problem. > > Only, how would it work from the console if that was the case? As a > > double check, curl also works from a terminal too. > > > It all works fine on my development box (Mongrel or console) - which > > just adds to the puzzle. > > > I would have thought that the console environment was identical to the > > mongrel environment. When I start up the console it reports that is > > "Loading stage environment". And I can see mongrel running using ps > > and it includes "-e stage" so I''m pretty sure the environments are the > > same. > > > Running Ruby 1.8.6 on Rails 2.1.0, Mac OS X Server 10.5.4 > > > Thanks. > > > - > > Bill--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---