Strange problem in production

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).

Any idea why this can happen?

Thanks,
Al

Hey AD,
I am not sure here, but i suspect might this is the problem,
concurrency.
just check with some sample application with small data set.

P.s:
As i said i am not sure.

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.

Thanks,
Al

I don’t have :frowning:

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.

Now I need to find the error.

Thanks

Hi,

Now I need to find the error.

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).

good luck,

javier ramirez

Have you written your tests and do they pass?

Rein

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs