Quantcast
Channel: Active questions tagged feedjira - Stack Overflow
Viewing all articles
Browse latest Browse all 30

Rails: Timeout when opening file on same server

$
0
0

I have a Rails controller method that does nothing but opens a file on the same server:

open 'http://lvh.me:3000/feeds/madonna.rss'

About 60% of the time, when I start the server, and hit this controller method, the 'open' call times out with:

Net::ReadTimeout: Net::ReadTimeout

The rest of the time it opens just fine.

It also seems that if the first request works after starting the server, it'll continue to work on subsequent requests. And if the first request fails, it'll continue to fail.

The failures only seem to occur when the file to open is on the same server that's make the request. In other words, when I change the URL to call the same endpoint but on the staging server, it seems to work every time.

The same exact behavior occurs with both open-uri and FeedJira.

Could there be some blocking issue with the server trying to make a request to the same server? Any ideas how to get around this or debug it further?

Here is the controller method that makes the call to generate the feed:

  def add_feed    url = params['url']    puts "FEEDJIRA"    open url    # feed = Feedjira::Feed.fetch_and_parse(url)    # eventually return response... but we timeout on the line above  end

Here is the controller that the 'url' above hits (i.e. 'http://lvh.me:3000/feeds/madonna.rss') to generates the feed:

class FeedsController < ApplicationController  def show    respond_to do |format|      format.rss  { render :layout => false }    end  endend

Here's the log:

env_host: lvh.me:3000Host: lvh.me   (0.9ms)  BEGIN  SQL (0.7ms)  UPDATE "users" SET "last_seen_at" = $1, "updated_at" = $2 WHERE "users"."id" = $3  [["last_seen_at", "2018-01-08 19:47:29.215953"], ["updated_at", "2018-01-08 19:47:29.218610"], ["id", 3071]]   (1.6ms)  COMMITFEEDJIRAStarted GET "/feeds/madonna.rss" for 127.0.0.1 at 2018-01-08 11:47:29 -0800Completed 500 Internal Server Error in 120051ms (ActiveRecord: 7.3ms)Net::ReadTimeout (Net::ReadTimeout):app/controllers/registrations_controller.rb:105:in `add_feed'

Viewing all articles
Browse latest Browse all 30

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>