We've been seeing DSpace crash a lot recently. Digging into the Catalina 
logs, I am seeing severe errors indicating a java memory leak: 

SEVERE: A web application registered the JBDC driver [org.postgresql.Driver] 
but failed to unregister it when the 
web application was stopped. To prevent a memory leak, the JDBC Driver has been 
forcibly unregistered.
SEVERE: A web application created a ThreadLocal with key of type 
[org.springframework.core.NamedThreadLocal] 
(value [Prototype beans currently in creation]) and a value of type [null] 
(value [null]) but failed to remove it when 
the web application was stopped. To prevent a memory leak, the ThreadLocal has 
been forcibly removed.
SEVERE: A web application registered the JBDC driver [org.postgresql.Driver] 
but failed to unregister it when 
the web application was stopped. To prevent a memory leak, the JDBC Driver has 
been forcibly unregistered.
SEVERE: A web application appears to have started a thread named 
[MultiThreadedHttpConnectionManager cleanup] but has 
failed to stop it. This is very likely to create a memory leak.
SEVERE: A web application appears to have started a thread named 
[TP-Processor6] but has failed to stop it. 
This is very likely to create a memory leak.
SEVERE: A web application created a ThreadLocal with key of type 
[org.springframework.core.NamedThreadLocal] 
(value [Prototype beans currently in creation]) and a value of type [null] 
(value [null]) but failed to remove it when 
the web application was stopped. To prevent a memory leak, the ThreadLocal has 
been forcibly removed.

Looking at the dspace logs, I am seeing many Java OutOfMemory errors: 

2015-09-27 02:02:20,235 ERROR org.dspace.app.mediafilter.PDFFilter @ Error 
parsing PDF document Java heap space
java.lang.OutOfMemoryError: Java heap space
        at 
org.apache.pdfbox.io.RandomAccessBuffer.expandBuffer(RandomAccessBuffer.java:151)
        at 
org.apache.pdfbox.io.RandomAccessBuffer.write(RandomAccessBuffer.java:131)
        at 
org.apache.pdfbox.io.RandomAccessFileOutputStream.write(RandomAccessFileOutputStream.java:108)
        at 
java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
        at java.io.BufferedOutputStream.write(BufferedOutputStream.java:126)
        at 
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptData(SecurityHandler.java:294)
        at 
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptStream(SecurityHandler.java:391)
        at 
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decrypt(SecurityHandler.java:363)
        at 
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptObject(SecurityHandler.java:337)
        at 
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.proceedDecryption(SecurityHandler.java:177)
        at 
org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.decryptDocument(StandardSecurityHandler.java:257)
        at 
org.apache.pdfbox.pdmodel.PDDocument.openProtection(PDDocument.java:1325)
        at org.apache.pdfbox.pdmodel.PDDocument.decrypt(PDDocument.java:796)
        at 
org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:310)
        at 
org.dspace.app.mediafilter.PDFFilter.getDestinationStream(PDFFilter.java:101)
        at 
org.dspace.app.mediafilter.MediaFilterManager.processBitstream(MediaFilterManager.java:737)
        at 
org.dspace.app.mediafilter.MediaFilterManager.filterBitstream(MediaFilterManager.java:561)
        at 
org.dspace.app.mediafilter.MediaFilterManager.filterItem(MediaFilterManager.java:511)
        at 
org.dspace.app.mediafilter.MediaFilterManager.applyFiltersItem(MediaFilterManager.java:479)
        at 
org.dspace.app.mediafilter.MediaFilterManager.applyFiltersAllItems(MediaFilterManager.java:414)
        at 
org.dspace.app.mediafilter.MediaFilterManager.main(MediaFilterManager.java:333)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)


Our Java memory options are set to 4096M, which is half of the memory we have 
(8G ram):

# dspace requires tomcat to use UTF-8, and also recommends memory parameters
JAVA_OPTS="${JAVA_OPTS} -Xmx4096M -Xms4096M -Dfile.encoding=UTF-8"

We've just set up a cron to do nightly restarts of tomcat. I was just wondering 
if anyone else had some advice on handling 
these out of memory errors? Is there anything else we can do aside from the 
nightly restart? 

Thanks,
Chelsea

-- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

Reply via email to