Forum: Ruby on Rails fastcgi help!!!

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Manish S. (Guest)
on 2006-05-03 21:45
(Received via mailing list)
Something really weird happened with my app recently and i'm lost on
what
exactly happened.

I have a bunch of validations setup in my models to ensure that no
records
have identical columns within a certain date range.  So user x can only
post
a blog entry to blog y once a month (example).

However, i saw that this validation failed on script that posts a bunch
of
entries all by the same user.  So the db showed the same user posting to
the
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
found
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
the
culprit.  Could it be that 2 fastcgi processes go the request at the
same
time and independently validated the data?  Meaning that when either
fcgi
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
against
this?

Please, please help.  Thanks in advance.
Kelly F. (Guest)
on 2006-07-28 10:35
(Received via mailing list)
I think I'm seeing the same thing. I have a model, Member, that has:

validates_uniqueness_of   :email

Yet, I have some non-unique emails. I've got a test that tries to create
2
members with the same email and it fails appropriately.

Any suggestions?

Thanks,

-Kelly
This topic is locked and can not be replied to.