CounterService database connection is disconnected after long periods of inactivity

Description

addressed an issue where the counter service caused the connection pool to run out of connections. This fix works well for the most part, but there is a side effect where the database terminates the jdbc connection on deployments that have long periods of inactivity (mysql default is 8 hours).

The most generic solution for this is to create a Job that will sent heartbeats (a simple query) to let the database know that this connection is still alive at a default interval of 60 minutes. This is configurable via portal-ext.properties:

#

  1. Set the interval in minutes for the ConnectionHearbeatJob.
    # This will determine how often the database is polled for long running
    # connections and will prevent the database from disconnecting the socket
    # prematurely.
    #
    counter.connection.heartbeat.job.interval=60

Activity

Show:

MikaMJanuary 15, 2009 at 12:12 AM

Database restarts can be handled by connection pool. At least C3P0 does quite good job on verifying the connections but that requires you to get the connection from the pool and not hog it for eternity.

michael youngJanuary 12, 2009 at 10:37 AM

Thanks for your comments regarding this. We haven't addressed the issue regarding database restarts because it needs to be addressed not just in the counterservice but any DAO's.

However, in most real world cases there will be at least some redudancy at both the app server and database layers, so this should not be so much of an issue.

If you're running a smaller deployment likely you can also tolerate app server and database restarts as well.

Brian ChanNovember 13, 2008 at 11:42 AM

Nice fix...

Fixed

Details

Assignee

Reporter

Liferay Contributor's Agreement

Accept

Fix versions

Affects versions

Priority

Zendesk Support

Created November 12, 2008 at 4:16 PM
Updated June 23, 2023 at 7:32 PM
Resolved November 13, 2008 at 11:42 AM
Loading...