Most bizarre bug hunt this month!

Posted by andy

Today I spent about an hour hunting down the cause of some bizarre behavior in one of our new Rails projects. The action in question handles both GET/POST. In the GET part I do an XMLRPC call to an external system to generate some hash value and store it in the session. This data is then shown on screen and further interaction with the customer is done through Ajax. The content on screen however did not match the value stored in the customer’s session. It turns out the application received two or sometimes three GET request in short succession! However, the browser (Firefox) would only display data from the very first GET request. Where were these other ghostly GET’s coming from??!! They came from this piece of HTML in the default layout template:

<link rel="Shortcut Icon" href="" />


So Firefox (and any other browsers?) will call the current request path of your application for elements with empty hrefs. I think this is proper behavior from the browser, but it might cause some really nasty side effects in your application!! Suffice it to say, the dude responsible for this template will be punished sever…oh crap, that was me too!

Comments

Leave a response

  1. p3t0rSeptember 20, 2006 @ 09:40 PM
    Ah, good to know! But wouldn't it be good (next to avoiding empty link-hrefs) to check and see if the session contains a valid hash? I don't know about the project, but I assume you only need to calculate the hash once... not on every reload! This would at least take care of unwanted/unexpected browser behaviour.
  2. Thijs van der VossenSeptember 20, 2006 @ 10:21 PM
    Hehe... :-)
  3. andySeptember 21, 2006 @ 12:20 AM
    Because of security/cheating concerns each GET request must always genereate a new hash/verifying code.

    -andy