Something really weird happened with my app recently and i’m lost on
I have a bunch of validations setup in my models to ensure that no
have identical columns within a certain date range. So user x can only
a blog entry to blog y once a month (example).
However, i saw that this validation failed on script that posts a bunch
entries all by the same user. So the db showed the same user posting to
same blog all within a few seconds of each other.
I looked at my access log and saw that there were 2 HTTP POSTs to the
controller at the same time that these duplicate entries got saved. I
this weird because i had the validations in place, and when i test on my
laptop i’m not able to recreate it. This made me think about fastcgi as
culprit. Could it be that 2 fastcgi processes go the request at the
time and independently validated the data? Meaning that when either
process did a read to validate, they both passed because neither had
committed the data yet.
Does this sound reasonable? If so, how would i go about guarding
Please, please help. Thanks in advance.