[Dspace-tech] Postgresql "remaining connection slots are reserved for non-replication superuser connections" during record import

1,756 views
Skip to first unread message

Hayden Young

unread,
Aug 26, 2015, 12:07:48 PM8/26/15
to dspac...@lists.sourceforge.net
I'm getting an error when I try to import a record into DSpace 3.x:

Exception: FATAL: remaining connection slots are reserved for
non-replication superuser connections
org.postgresql.util.PSQLException: FATAL: remaining connection slots are
reserved for non-replication superuser connections
at
org.postgresql.core.v3.ConnectionFactoryImpl.readStartupMessages(ConnectionFactoryImpl.java:471)
at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:112)
at
org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
at
org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:125)
at
org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
at
org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:22)
at
org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:32)
at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:393)
at org.postgresql.Driver.connect(Driver.java:267)
at java.sql.DriverManager.getConnection(DriverManager.java:579)
at java.sql.DriverManager.getConnection(DriverManager.java:221)
at
org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:75)
at
org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
at
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:974)
at
org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
at
org.dspace.storage.rdbms.DatabaseManager.getConnection(DatabaseManager.java:588)
at org.dspace.core.Context.<init>(Context.java:90)
at org.dspace.app.itemimport.ItemImport.main(ItemImport.java:430)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:183)


My command is:

./dspace import --test -a -e hayde...@wijiti.com -c 123456789/40 -s
/tmp/ -z item_export_2013_Dec_30_1_103.zip -m /tmp/mapfile

The number of max connections is set to 128 in dspace.cfg. This is just
a demo instance of DSpace so there shouldn't be much going on there. I
could increase the number of connections but 128 seems high considering
hardly anyone accesses this instance (I'm the first person to use it in
2 weeks).

Any help much appreciated.

helix84

unread,
Aug 26, 2015, 12:08:24 PM8/26/15
to Hayden Young, dspace-tech
Hi Hayden,

what are your values of db.maxconnections in dspace.cfg and
max_connections in postgresql.conf?

What value does the following query return when the problem is occurring?
SELECT count(*) FROM pg_stat_activity;


Regards,
~~helix84

Compulsory reading: DSpace Mailing List Etiquette
https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Hayden Young

unread,
Aug 26, 2015, 12:08:32 PM8/26/15
to hel...@centrum.sk, dspace-tech
Hi Helix

Thanks for replying. db.maxconnections was 128 now 256. Unfortunately
when the problem occurs I'm unable to log into psql and execute "SELECT
count(*) FROM pg_stat_activity;" to find out more. I'll monitor further
and see if the logs return anything. Unfortunately the problem seems to
be very intermittent.

Cheers


Hayden

helix84

unread,
Aug 26, 2015, 12:08:41 PM8/26/15
to Hayden Young, dspace-tech
On Tue, Jan 7, 2014 at 3:52 PM, Hayden Young <hayde...@wijiti.com> wrote:
> Thanks for replying. db.maxconnections was 128 now 256.

What about max_connections in postgresql.conf? Make sure the number is
slightly higher than db.maxconnections, e.g. 260.

> Unfortunately when
> the problem occurs I'm unable to log into psql and execute "SELECT count(*)
> FROM pg_stat_activity;" to find out more.

Try logging in with an admin role, there should be some connections
reserved for that use.

Hayden Young

unread,
Aug 26, 2015, 12:08:57 PM8/26/15
to hel...@centrum.sk, dspace-tech
Looks like it was about 50. I've raised it to 260 as you said so I'll
see how that plays.

Cheers


Hayden
Reply all
Reply to author
Forward
0 new messages