PostgreSQL connection issue - Dropping idle connections - postgresql

Brief Background:
We have a cloud based Warehouse Management System that uses Glassfish to dish out the java interface. The Warehouse Management System consists of a Dashboard and a mobile application - both of which talk constantly with the Glassfish server (using a web browser).
Issue:
Recently our PostgreSQL database server HDD failed. After restoring from a backup and moving the database to an Amazon Web Service Server, idle connections seem to be dropping out. This causes the entire Warehouse Management System to fail. Restarting the Glassfish server seems to fix the issue until the idle connection causes it to fail again.
It happens around 3-4 times per day after approx 20mins of idle activity i.e. our customer's lunch breaks, after hours etc..
Question:
Is there a setting that I'm missing in the postgresql.conf file? What else could be causing this?
Attachments:
I've attached a screenshot containing the output of running 'select * from pg_stat_activity;' and also the postgresql.conf file.
select * from pg_stat_activity
postgresql.conf
Log:
postgresql-8.4-main.log shows this occasionally, although it doesn't seem to be when it cuts out.
2015-10-19 07:51:41 NZDT [9971-1] postgres#customerName LOG: unexpected EOF on client connection
glassfish server.log is riddled with these lines:
[#|2015-10-19T07:46:49.715+1300|SEVERE|glassfish3.1.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=25;_ThreadName=Thread-2;|WebModule[/pns-CustomerName]Received InterruptedException on request thread
[#|2015-10-20T09:34:42.351+1300|WARNING|glassfish3.1.1|com.sun.grizzly.config.GrizzlyServiceListener|_ThreadID=17;_ThreadName=Thread-2;|GRIZZLY0023: Interrupting idle Thread: http-thread-pool-8080(2).|
[#|2015-10-20T07:33:55.414+1300|WARNING|glassfish3.1.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=14;_ThreadName=Thread-2;|Response Error during finishResponse java.lang.NullPointerException
Thanks in advance

Related

Large number of Sleep connections to database in TYPO3

Our TYPO3 application is experiencing downtime issues, with the logs displaying the error:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: An exception occured in driver: Too many connections
If I connect to the MySQL database and run SHOW PROCESSLIST, all I see are lots of connections with the command “Sleep”. This seems like a red flag to me but this is not my area of expertise; is there a good reason for this and if not what might the fix be?
the PHP mysqli Driver allows for Persistent connections.
which basically means a connection is kept open and put to "sleep" till needed again.
this is a tradeoff: an already open connection does not need to be re-establisched so you can query faster. but at the cost that both systems spend some resources (Memory, CPU) on keeping the connection alive.
see the PHP documentation for more details:
https://www.php.net/manual/de/mysqli.persistconns.php
and configuration options (php.ini)
https://www.php.net/manual/de/mysqli.configuration.php

What could be the potential reasons for Windows service to hang?

We are facing issue with windows service, its hanging just after opening the oracle connection and while creating the oracle command.
Before killing the service, when we analyzed the database logs, it showed the inactive session (not closed) and it’s matching the ‘DB last call time’ with the ‘service hung time’. That particular db session keeps waiting for application to instruct the next steps and stays idle, until we kill the service.
Most importantly this issue happens only sometimes without any pattern.
We have pool size set to 50 and connection timeout to 10min at application.
Types of oracle commands used:
using (OracleCommand cmd = oraCon.CreateCommand())
_cmd = new OracleCommand(“sqlText”, _connection)

Slow connection to DB2 on Cloud Database ( from WildFly server aplication)

I need some help! Some time ago we migrated an Oracle database to DB2 on Cloud.
My application use a WildFly Server and the connection to Oracle database previously only needed 5 minutes to start, that was a normal time to start.
However, when I start using DB2 on cloud, the time to start is about 14 minutes.
Using IBM Data Server Manager, I tried to monitor what is happening with the database during the application server connection and I can see a process call "Compilation Process", which is responsible for the time to complete the connection. I do not understand if that is normal, or if there exists any solution to decrease the time used for that process. Thank you very much !!

Opening DB connections to Postgres taking long

Some of our applications are facing issues with the connection pool. I run one of them. A JEE application on Payara 4.1 which uses PostgreSQL 9.5.8.
I have as good as no problems when running the application localy with local db instance. When running on the remote environment I have seen issues happening every 10 minutes that the application was unresponsive (well, it actually responded everything with HTTP status 503). Guessing it was related to opening connections taking long, we have set the parameter idleTimeoutInSeconds="0" in jdbc-resource. Now we have the same issues about 4 times a day which is an improvement, but - well - neighbour systems are still complaining.
We usually run with 5 steady connection allowing maximum connections of 30. Our application usually uses 1 up to 2 to handle traffic. With TCP dump I have seen, that at a certain point in time the connection pool tries to open many connections (the pool realizes the connections it holds have been closed by the DB without any information like TCP FIN, opening each connections takes about 1 second). During this time of about 30 seconds not all requests can be safely queued and some 503 happen.
Locally everything is fine. Opening a connection takes ~50ms and everyone is happy. Our postgres team is not helping at all and I am stuck with a problem. As I don't see any improvement possibility with the connection pool in JEE, I have radical ideas going in the direction of:
Refreshing the connections myself. All the time. Constantly. (Which would be hard to implement in JEE where I can not simply look into the connection pool and tell each connection to be refreshed just in case).
Replacing the not-helping-at-all JEE implementation of connection pool with something that works better. (Future generations of developers maintaining our app will hate me...)
Replacing the DB with something managed by myself. (Even dumber idea)
Does anyone:
Has any idea how I could perform 1 or 2 above?
Has any other ideas what could help?
Here my current JDBC resource definition if needed:
<jdbc-resource poolName="<poolName>" jndiName="<jndiName>" isConnectionValidationRequired="true"
connectionValidationMethod="table" validationTableName="version()" maxPoolSize="30"
validateAtmostOncePeriodInSeconds="30" statementTimeoutInSeconds="30" isTimerPool="true" steadyPoolSize="5"
idleTimeoutInSeconds="0" connectionCreationRetryAttempts="100000" connectionCreationRetryIntervalInSeconds="30"
maxWaitTimeInMillis="2000">

Oracle 12c connection error:-Got minus one from a read call

My Sql developer was working fine from long time, suddenly from yesterday when i am trying to reconnect it is giving me following error:-
Status : Failure -Test failed: IO Error: Got minus one from a read call, connect lapse 62991 ms., Authentication lapse 0 ms.
Things I tried to solve the issue:-
Made corresponding changes in sqlnet.ora , listener.ora and tnsnames.ora files
Checked is there are too many open connections to the database service.
Restarted ORACLE service and listener
Firewall related changes
Reinstalled ORACLE
In my case the issue, it is due to a malware. Whenever i am trying to connect to DB port, it was automatically getting changed by malware.
You can also identify the problem by using lsnrctl status command, for further information. You can also see the log file of listener.
Run a full scan on your machine and restart listener, hope that helps.