let's say I have some authors and update their books list (very
complicated algorithm).
Everything works great in development mode, however in production mode
the id's get mixed, the books get assigned to the wrong author (maybe
if 2 or more requests happen in the same time), like somehow they
share some variables. This is not happen in development mode (same
conditions).
of course it is concurrency, but why? I can't avoid this, the request
came from the web, so obviously I somehow use some kind of static
variable shared between processed, only I don't even know if static
variables exists...
The main hint can be that is happen only in production mode, so I'm
still looking for an idea.
But I found the answer (not yet the error) in an old post of javier
ramirez:
of yep.. when you are in development mode, the classes (most of them
anyhow) get reloaded at each request. This means the code is
reinterpreted every time and that's why: a) you don't need to restart
so
it's cool to try things quickly, and: b) it's much slower than running
in production mode.
When in production, the classes get interpreted when loaded, and they
are not reinterpreted every time. That's why you need to restart the
server when you change the code. This means the class variables will
keep their values between calls unless you modify them explicitely.
it looks like the error could be in the use of class/global variables.
Look for cattr and for $ in your classes (and i hope you are not doing
that, but look also for $ in your views). Class attributes and global
variables are shared for the whole process (meaning your
mongrel/webrick).