Coupure de connexion entre Rails 3.2.7 et Postgres 8.4

Bonjour à tous,

Je développe une grosse application en Rails 3.2.7 qui est connecté à une BD Postgres 8.4 installée sur la même machine. L'application s'exécute sur Apache avec le module Passenger.

L'application est constamment utilisée par une centaine d'utilisateurs et ne pose aucun problème pendant plusieurs heures puis, d'un coup, Rails ne parvient plus à faire de requêtes vers la BD sans trop que je comprenne pourquoi. Les sessions étant stockées en BD, tous les utilisateurs sont alors déconnectés. La page de login faisant appelle à des enregistrements dans la BD, elle n'est donc plus atteignable.

Voici le contenu de database.yml :

production: adapter: postgresql database: ******_prod pool: 5 username: ****** password: ****** encoding: utf8

development: adapter: postgresql database: ******_dev pool: 5 username: ****** password: ****** encoding: utf8

Voici ce qui se passe comme erreur dans un contrôleur qui tente d'accéder à la BD :

- Le code : time = (Parameter.find(:first, :conditions => ["name=?", "login_error_wait"])).value - L'erreur : undefined method 'value' for nil:NilClass

Le paramètre recherché étant bien présent en BD. Ce code fonctionne parfaitement en temps normal jusqu'à ce que Postgres renvoi subitement la valeur nil.

Quelqu'un aurait-il déjà eu ce genre de problème ou aurait-il une idée d'où cela pourrait venir?

Je suis fortement ennuyé car il s'agit d'une application utilisée environ 2 heures par jours par chaque personne dans l'entreprise où je travaille.

Merci d'avance pour vos réponses :wink:

I google translated what you have written and as I understand database connection is not a problem. After some time your query returns nil for where should have been same data. You could try newer Postgress. 9.2 is the latest. Search logs for strange errors.

This line:

time = (Parameter.find(:first, :conditions => ["name=?", "login_error_wait"])).value

can be done differently in 3.2.7 and I can also advice you this:

t = Parameters.where("name" => "login_error_wait").first if t.nil?   do some debugging end time = t.value

by TheR

Thank you for your answer, I will try to upgrade Postgres.

I will reply if it works.

This is the topic in English :

"

Hi all,

(Sorry for my bad English)

I'm developing a large application in Rails 3.2.7, which is connected to a DB PostgresQL 8.4 installed on the same machine. The application runs on Apache with Passenger module.

The application is constantly used by hundreds of users and no problem for several hours and then, suddenly, Rails is no longer able to make requests to the DB without too I understand why. The sessions are stored in BD, then all users are disconnected. The login page making calls to records in the database, it is no longer attainable.

Here are the contents of database.yml:

production: adapter: postgresql database: ****** _prod pool: 5 username: ****** password: ****** encoding: utf8

development: adapter: postgresql database: ****** _dev pool: 5 username: ****** password: ****** encoding: utf8

Here's what happens as a controller error trying to access the DB:

- Code: time = (Parameter.find (: first,: conditions => [

Last edited by remiuz (2012-10-11 09:14:29)

"

Rémi Nuyts wrote in post #1079378: