views:

28

answers:

2

After correcting some other bugs on the application I found out that one page is being rendered twice on every request.

Rails completes the request normally and after a few, simply starts another request.

At first thought it was a Firebug problem or YSlow doing other requests, but after more tests the duplication remained and I discarded those reasons.

I tried even debugging rails step by step in the request, it goes normally and after completing the first request, I get stopped in the same debugger start line again, this time for the second request.

Printed some lines and things to see clearly on log and it clearly makes 2 requests.

I also found a few wierd requests that I cannot explain also

This bit of log shows the end of the first request and right after that one, there is a wierd index request without layout and then the same request starts again to be processed:

    Processing ArtistImagesController#index (for 192.168.0.11 at 2010-07-08 15:10:56) [GET] 
    Parameters: {"action"=>"index", "locale"=>"pt", "controller"=>"artist_images", "artist_id"=>"2-tom-welling"}

    #^ Start of first request
    #v end of first request

    Completed in 812ms (View: 429, DB: 41) | 200 OK [http://192.168.0.20/artistas/2-tom-welling/imagens]
          SQL (0.2ms)   SET NAMES 'utf8'
          SQL (0.2ms)   SET SQL_AUTO_IS_NULL=0

    # v wierd request     
        Processing ApplicationController#index (for 192.168.0.11 at 2010-07-08 15:10:59) [GET]
        Rendering rescues/layout (not_found)
        -----------------------------------------------------> html
          SQL (0.2ms)   SET NAMES 'utf8'
          SQL (0.2ms)   SET SQL_AUTO_IS_NULL=0

    # v start of second request
        Processing ArtistImagesController#index (for 192.168.0.11 at 2010-07-08 15:11:00) [GET]
          Parameters: {"action"=>"index", "locale"=>"pt", "controller"=>"artist_images", "artist_id"=>"2-tom-welling"}

Remembering that all those requests were generated by entering the page only once :/ Searched the code for possible loops or any kind of errors but haven't found any.

Please help is very appretiated

+1  A: 

Search your page source for empty image src attributes. For such images the browser requests the site root, which seems to be the case.

neutrino
I've searched the HTML and didn't find those empty src="" but I did find unclosed <img> tags and after closing them now I get 3 requests instead of 2...Opening the site on lynx actually gave me one request only, but that's not somethig that will happend with final users :p
Angelus
@Angelus:could you share your view file? probably the problem might be in the index view page.
Vamsi
It was almost as neutrino said.After reviewing the code, I found an empty inline CSS with background-image: url().Worked perfectly now. Thanks !
Angelus
A: 

I think your page is submitting two times. can i view your page.