So the problem started when we noticed that there are cases of duplicate orders on our website. When we started investigating, we couldn't narrow down something which could cause duplicate orders on our page and yet explain the state of the duplicate data. The eeriest part was that those orders were created at the SAME instant (down to smallest millisecond). In access logs in server too, the requests are received at the same instant.
So in order to investigate further we called random customers, most of them had close to the same answers, that they use a slow connection (some of them through modem) and they use chrome. Most feedback is like, page was stuck so I pressed back button. After some search we learnt of Http pipelining feature in chrome which is an aggressive technique to fetch the page in case connection is slow.
So here is the deal, user presses the Submit button --> a verify ajax JSON call (GET) --> form data is POSTed thru ajax JSON call --> returns some feedback to customer, customer takes action and then is redirected appropriately.
I am not sure if this is the best use of the AJAX or even GET/POST calls , but this is what I am stuck with.
Since this problem occurs in very specific (slow connection and chrome must fire duplicate connections) and truth be told, I have not been able to replicate this. However since nearly 95% feedback points towards Chrome, I am forced to think of http pipelining. It is the only possible explanation that could fire requests, so that multiple records are created at same instant.
I also learnt that http pipelining is done only for GET requests not POST requests. So I am not sure whether:
this covers AJAX POST requests (I use jQuery and I do use type:POST) Chrome may somehow be back (erroneously) throwing multiple requests for all requests (refer: What to do with chrome sending extra requests?)
Only argument I could find in Chrome's case is that http pipelining is disabled by default.
I am not even sure what checks to put in this case, since the both the requests are being served at the same instant. I could put a check at backend to check if similar record is created, but that would be an expensive check, slowing down ordering and business may not welcome it.
I found something at http://www.chromium.org/developers/design-documents/network-stack/http-pipelining but not sure I must force/hack my requests to meet one of the criteria to stop http pipelining.
Any points to test this would be appreciated.