Title: Re: [Dspace-tech] Context and mets
Hi,

On 19/04/13 10:37, Matthew Drover wrote:
I was doing context.complete() instead of context.abort().

That should be fine -- as long as you call one of these two, since both free up the database connection. Is that the only customisation you have in your code? Might it be that you're creating a new context object somewhere else without tidying up after it?

When I was debugging some of my own code, I changed the finalize method in Context to read as follows:

    protected void finalize() throws Throwable
    {
        /*
         * If a context is garbage-collected, we roll back and free up the
         * database connection if there is one.
         */
        if (connection != null)
        {
            log.warn("In context.finalize(): connection isn't null, calling abort() now. This is a likely source of a DB connection leak and should be investigated.");
            abort();
        }

        super.finalize();
    }

That way I could then check the dspace log file for this warning, just to be sure I explicitly abort/complete all my context objects.

If you're still getting the exceptions you mentioned in your original post, you might need to play around with the DSpace database settings and/or tomcat's garbage collection settings. "My" repositories are doing fine with

# Maximum number of DB connections in pool
db.maxconnections = 50

# Maximum time to wait before giving up if all connections in pool are busy (milliseconds)
db.maxwait = 5000

# Maximum number of idle connections in pool (-1 = unlimited)
db.maxidle = -1

# Determine if prepared statement should be cached. (default is true)
db.statementpool = true

and

JAVA_OPTS="${JAVA_OPTS} -Xmx1536m -Xms1536m -XX:MaxPermSize=256m -XX:+DisableExplicitGC -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"

on a machine with 3 GB RAM and 2 CPUs (which influences Java's default garbage collection settings, see http://www.oracle.com/technetwork/java/ergo5-140223.html). We're using Sun Java 1.6.

cheers,
Andrea

-- 
Dr Andrea Schweer
IRR Technical Specialist, ITS Information Systems
The University of Waikato, Hamilton, New Zealand


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Reply via email to