Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Postgres default connection is too high #4062

Closed
shuse2 opened this issue Aug 9, 2019 · 3 comments
Closed

Postgres default connection is too high #4062

shuse2 opened this issue Aug 9, 2019 · 3 comments

Comments

@shuse2
Copy link
Collaborator

shuse2 commented Aug 9, 2019

Expected behavior

Postgresql default max number of connection is 100, so the SDK should comply with the max number of connection

Actual behavior

Currently max connection is 95 * 3 modules, which is 275.
Therefore, for some case, it will hit the max number of connection.

07:11:24.880Z ERROR lisk-framework: remaining connection slots are reserved for non-replication superuser connections (err.code=53300)
    error: remaining connection slots are reserved for non-replication superuser connections
        at Connection.parseE (/Users/x/xxx/node_modules/pg/lib/connection.js:554:11)
        at Connection.parseMessage (/Users/x/xxx/node_modules/pg/lib/connection.js:379:19)
        at Socket.<anonymous> (/Users/x/xxx/node_modules/pg/lib/connection.js:119:22)
        at Socket.emit (events.js:189:13)
        at Socket.EventEmitter.emit (domain.js:441:20)
        at addChunk (_stream_readable.js:284:12)
        at readableAddChunk (_stream_readable.js:265:11)
        at Socket.Readable.push (_stream_readable.js:220:10)
        at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
07:11:24.883Z  INFO lisk-framework: Cleanup controller...
07:11:24.883Z ERROR lisk-framework: Reason: Error: DB Connection Error

Steps to reproduce

Starting the application with default setup

Which version(s) does this affect? (Environment, OS, etc...)

2.0-

@kplusq
Copy link

kplusq commented Aug 10, 2019

I had a same error in v2.2.0, but there was no trouble in v2.1.0.
There were three instance at v2.1.0. however from v2.2.0, there are four since controller has own connection.
It's just a guess but, is there a possibility that the change might have caused it?
(I tried to do initial DB creation with v2.1.0, then run v2.2.0. In that case, no error occurred.
also I tried to halt http_api module connections, then that worked fine.)

@kplusq
Copy link

kplusq commented Aug 11, 2019

Sorry, that was my misunderstanding.
I suppose the problem has nothing to do with the number of instance, but a timing of loadBlockChain execution .
In v2.1.0, API module and Network module are loaded before loading Blockchain.
However in v2.2.0, it seems loading those modules are called after loading Blockchain.
so in that case, if max setting is 95, full of connections are used by Chain module.

@nazarhussain
Copy link
Contributor

I agree, that default value was carry forward when every thing was using single db object. Now since load been splitted between modules so default max connection can be reduced.

shuse2 added a commit that referenced this issue Aug 13, 2019
@shuse2 shuse2 closed this as completed Aug 13, 2019
@ishantiw ishantiw changed the title Postgres default connection is too heigh Postgres default connection is too high Aug 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants