Good day. There are 2 domains (2 projects). One performs the authorization function, the second working site. My steps: 1. Authorization on the auth.domain.ru domain 2. Use of the domain.ru domain 3. Each subsequent loading of any page of domain.ru slows down the work of the database with the session table so that the loading of the page becomes simply impossible.

Those. I am authorized to open the site domain.ru. It's ok. Reboot, reboot, reboot. Loading is already slower. If you restart 10 again, the download is no longer running.

And viewing the data in the session table also becomes sad. The window hangs, then it is still loaded, but it does not show the data of the column with the jsonb type. The postgresql database.

After a long wait for the page to load, the download stops and the node.js application gives an error

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

Please tell me how to solve the problem.

Session code:

app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.use(session({ store: new pgSession({ pg : pg, // Use global pg-module conString : 'http://postgres:mydatabase@127.0.0.1:5432/data', // Connect using something else than default DATABASE_URL env variable tableName : 'session' // Use another table-name than the default "session" one }), secret: 'mysecret', cookie: { maxAge: 30 * 24 * 60 * 60 * 1000, domain: 'domain.ru' }, resave: false, saveUninitialized: true, secure: true })); app.use(passport.initialize()); app.use(passport.session()); app.use(cookieParser()); 
  • So you looked who ate all the memory? - Alexey Ten
  • Node.js has a memory leak due to authorization. He brought up to the moment when the application uses 700 MB of RAM, and jumps and jumps from 700 to 1500 MB. Those. problem in the string "domain: 'domain.ru'". I do not even know what to do. - Keefred
  • Replaced PostgreSql with MongoDB - the same trouble. - Keefred
  • Using MongoDB produced an error: "RangeError: attempt to write outside buffer bounds" Ie It writes data to the session bd. But why is this done and how? After all, the server should only receive data from the session. Strange ... - Keefred
  • Because of this, even MongoDB does not start now, it produces: "*** aborting after fassert () failure", with the error "Fatal Assertion 34433" And this is corrected only by removing DB ( - Keefred

0