Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Timeouts bubble up through rescue blocks and kill tentacles

#33

The thread body of the tentacle looks like this:

    def run
      loop do
        link, referer, depth = @link_queue.deq

        break if link == :END

        @http.fetch_pages(link, referer, depth).each { |page| @page_queue << page }

        delay
      end
    end

Theoretically, we are protected from exceptions because fetch_pages has a catch-all rescue...

    def fetch_pages(url, referer = nil, depth = nil)
      begin
        url = URI(url) unless url.is_a?(URI)
        pages = []
        get(url, referer) do |response, code, location, redirect_to, response_time|
          pages << Page.new(location, :body => response.body.dup,
                                      :code => code,
                                      :headers => response.to_hash,
                                      :referer => referer,
                                      :depth => depth,
                                      :redirect_to => redirect_to,
                                      :response_time => response_time)
        end

        return pages
      rescue => e
        if verbose?
          puts e.inspect
          puts e.backtrace
        end
        return [Page.new(url, :error => e)]
      end
    end

For the most part, you are safe.
Except in the case of Timeout::Error, which derives from Interrupt, not StandardError, and therefore bypasses the rescue block!

The solution is to explicitly capture it with an additional rescue Timeout::Error => e.

Reported by michael.harrington · July 30th, 2010 @ 12:39 PM

State: open
Milestone: 0.4.1
Assigned to: chris (at chriskite) chris (at chriskite)

Activity

  1. chris (at chriskite)
    chris (at chriskite)
    • State changed from new to open
    • Milestone set to 0.4.1
    • Milestone order changed from 185603 to 0

    July 30th, 2010 @ 07:31 PM

  2. chris (at chriskite)
    chris (at chriskite)

    Great catch, I'll include a fix for this in 0.4.1

    July 30th, 2010 @ 07:32 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.