A Side Effect of ySlow and Firebug
I spent a number of hours researching a bug in a Model-Glue application. Each time a form was submitted successfully, a duplicate record showed up in the database.
This application uses a number of frameworks and it wasn’t very clear which layer was causing the problem.
I started to dig into the issue, looking for any rhyme or reason and pinged my good buddy Ezra Parker for some sanity checks.
After some intense debugging, we found out that the second record in the database showed up after the ColdFusion request ended. I tried all sorts of programmer sorcery to find out why this second request happened and did not get much useful information. This duplicate request problem defied all logic!
Through the course of working through the information and issues, we explored many potential causes and questions like:
- Was Model-Glue possibly adding a second redirect somewhere?
- Was there a CFThread buried in Model-Glue, ColdSpring, Transfer or CFUniform that caused this?
- Was there some javascript call being fired off, and replicating the request?
- Were space hackers infiltrating my computer?
- Am I on Candid Camera?
- Should I just quit programming and open a Bakery?
We were able to get the second request to log to a file, but there was nothing in any of the scopes that pointed us to Firebug or ySlow as the culprits. Even the HTTP User Agent was normal: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 (.NET CLR 3.5.30729)
Eventually, after much trial and error, I realized the duplicate record only showed up when using Firefox with Firebug and ySlow enabled and on. When I turned off Firebug or disabled ySlow, the problem went away.
The root cause of this is ySlow requests the URL of the page in order to perform it’s tests and when it does, it’ll submit a form all over again. There are two ways to fix this symptom, you can:
Disable the Firebug setting Activate Same Origin URLs
In Firefox:
- Open the following menu series: Tools < Firebug < Options <
- Then uncheck Activate Same Origin URLs
Or Disable Autorun YSlow each time a web page is loaded
In Firefox:
- Close Firebug
- Reopen it
- Click on the ySlow tab
- Uncheck Autorun YSlow each time a web page is loaded