Thread: Need help on "org.postgresql.util.PSQLException: FATAL: terminating connection due to administrator command"

Hello,I'm using JSP for accessing postgre
My postgre version is 8.1 running on suse enterprise 10 linux machine.
My JSP container is Apache Tomcat 5.5.
My connection method is JNDI(pooling).
Recently I'm having trouble after my web application is being accessed by many users.
My error log shows something like this :
======================================
...
org.postgresql.util.PSQLException: FATAL: terminating connection due to administrator command
org.postgresql.util.PSQLException: FATAL: terminating connection due to administrator command
 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse (QueryExecutorImpl.java:1525)
 at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1309)
 at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
 at org.postgresql.jdbc2.AbstractJdbc2Statement.execute (AbstractJdbc2Statement.java:452)
 at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:340)
 at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java :239)
 at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)
 at org.diknas.sarpras.UtilDiknas.executeQuery(UtilDiknas.java:226)
 at org.apache.jsp.modul.monitoring.gofoto_jsp._jspService (gofoto_jsp.java:157)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 at org.apache.jasper.servlet.JspServletWrapper.service (JspServletWrapper.java:334)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
 at javax.servlet.http.HttpServlet.service (HttpServlet.java:802)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
 at org.apache.catalina.core.ApplicationDispatcher.doForward (ApplicationDispatcher.java:398)
 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
 at org.diknas.sarpras.monitoring.MonitoringFotoProcessor.doEntryView(MonitoringFotoProcessor.java :115)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java :25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.diknas.sarpras.monitoring.MonitoringFotoProcessor.doSelection(MonitoringFotoProcessor.java:96)
 at org.diknas.sarpras.monitoring.MonitoringFotoProcessor.doProcess (MonitoringFotoProcessor.java:54)
 at org.diknas.sarpras.monitoring.MonitoringProcessor.doFotoView(MonitoringProcessor.java:133)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.diknas.sarpras.monitoring.MonitoringProcessor.doSelection (MonitoringProcessor.java:91)
 at org.diknas.sarpras.monitoring.MonitoringProcessor.doProcess(MonitoringProcessor.java:50)
 at org.diknas.sarpras.Controller.doMonitoringEntry(Controller.java:143)
 at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke (Method.java:585)
 at org.diknas.sarpras.Controller.doSelection(Controller.java:97)
 at org.diknas.sarpras.Controller.doGet(Controller.java:66)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:173)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
 at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:107)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection (Http11BaseProtocol.java:664)
 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
 at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
 at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
 at java.lang.Thread.run(Thread.java:595)
...
=======================================
 
It seems that the exception came from Postgre : org.postgresql.util.PSQLException: FATAL: terminating connection due to administrator command
 
What's this ? I've tried to googling around and found something about resource limiter or something like that, but I don't seems understand the solution.
Is there any straight forward solution for my trouble here ? Cause I got really stuck here.
How to configure postgre to fix this ?
 
 
thanks.

Re: Need help on "org.postgresql.util.PSQLException: FATAL:

From
Richard Huxton
Date:
Wong Jowo wrote:
> Hello,I'm using JSP for accessing postgre
> My postgre version is 8.1 running on suse enterprise 10 linux machine.
> My JSP container is Apache Tomcat 5.5.
> My connection method is JNDI(pooling).
> Recently I'm having trouble after my web application is being accessed by
> many users.
> My error log shows something like this :
> ======================================
> ...
> org.postgresql.util.PSQLException: FATAL: terminating connection due to
> administrator command
[snip stack of java exception msgs]
> =======================================
>
> It seems that the exception came from Postgre :
> org.postgresql.util.PSQLException: FATAL: terminating connection due to
> administrator command

What do the PostgreSQL logs say (oh, and it's PostgreSQL or perhaps
Postgres, not "Postgre")? For that matter, what do the system logs say?
What was the system load at the time?

I'm assuming you haven't got any code that disconnects backends directly.

> What's this ? I've tried to googling around and found something about
> resource limiter or something like that, but I don't seems understand the
> solution.
> Is there any straight forward solution for my trouble here ? Cause I got
> really stuck here.
> How to configure postgre to fix this ?

I'm guessing that what's happening is you're running out of memory on
the machine and the Linux out-of-memory (oom) killer is killing
processes at random (and hitting PostgreSQL).

You'll either need to limit the number of concurrent connections, reduce
the memory usage of PostgreSQL or your other applicatons or add more
memory. To be honest, if you're running out of memory then performance
is going to be horrible anyway.

--
   Richard Huxton
   Archonet Ltd

Re: Need help on "org.postgresql.util.PSQLException: FATAL:

From
Richard Huxton
Date:
Please cc: the mailing list - that lets everybody help.

Wong Jowo wrote:
> The postgres error message is the same :
> FATAL: terminating connection due to administrator command
>
> But in log I saw that ther is on kind of error that  happened before the
> "FATAL: terminating connection due to administrator command", it's :
> "FATAL:  sorry, too many clients already".

Don't assume they're linked. If you've got lots of connections active
then the oom-killer might be acting too.

> I'm using the default postgres configuration on postgresql.conf.
>
> So, what should I do ?

Well, you're running connection pooling, so it's odd that you're running
out of connections, but you can alter that setting in postgresql.conf -
max_connections should default to 100.

You certainly want to adjust your memory usage etc. in postgresql.conf
too. This link is a good place to start
   http://www.powerpostgresql.com/PerfList

--
   Richard Huxton
   Archonet Ltd

The postgres error message is the same :
FATAL: terminating connection due to administrator command

But in log I saw that ther is on kind of error that  happened before the "FATAL: terminating connection due to administrator command", it's :
"FATAL:  sorry, too many clients already".

I'm using the default postgres configuration on postgresql.conf.

So, what should I do ?