On Dec 20, 2014, at 3:52 AM, darrell73s <[email protected]> wrote:

> Hi all,
> 
> Just as a follow up on this, I was ultimately able to get to the bottom of
> the issue. It turned out to be a product of my environment. I came to find
> out that in my environment, there is a stateful firewall which will
> terminate connections which are idle for a given period of time. By writing
> a test program which uses the driver directly (taking OFBiz out of the
> equation), I simulated the issue, and discovered that attempting to use the
> connection once it gets into the strange state after the firewall having
> killed it, the call to run the query hangs for about 15 minutes before
> returning and throwing an exception (if I remember correctly it was a socket
> read timeout). Even with the connection pooler attempting to run the test
> query would cause this hanging behavior, as it's attempting to execute the
> query on the bad connection. This means that when attempting to visit the
> application, the application retrieves a connection from the pool, attempts
> to log the Visit, but because the connection is in a bad state, the query
> hangs, without throwing an exception, and you see the original behavior I
> described. 
> 
> Because of my environmental constraints, I was not able to get the firewall
> modified, but was able to work around it by manipulating
> 'timeBetweenEvictionRunsMillis' and 'minEvictableIdleTimeMillis' such that
> connections are closed and re-established in the pool at a rate under the
> time at which the firewall will terminate them.

I agree that setting a proper value for the time-between-eviction-runs-millis 
is the right way to go.
With it, you can also enable:
test-while-idle="true"
and this should enable the validation of idle connections (by running the test 
query) at the frequency set by time-between-eviction-runs-millis

I hope it helps and congratulations for your progress.
Thanks for sharing these details, I am sure it will be valuable information for 
many users.

Jacopo 

> 
> I'm now working on tackling a different issue which I see every few days in
> my LIVE system where the status of a query in PostgreSQL will be "idle in
> transaction" and seems to cause other queries to begin piling up. So far, it
> has been queries on the Product, and ProductCalculatedInfo entities which
> are idle in transaction, but it appears to be at random times: one second
> the query works fine, the next it becomes idle in transaction. I've searched
> all of my hot deploy code to ensure that there are no transactions being
> manually controlled in the custom code (e.g. Maybe there was a begin
> transaction with no commit/rollback) but it all appears fine. Have any of
> you folks ever seen this problem with OFBiz and PostgreSQL?
> 
> Thanks!
> 
> 
> 
> --
> View this message in context: 
> http://ofbiz.135035.n4.nabble.com/Tomcat-Unresponsive-tp4659005p4659936.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply via email to