cancel
Showing results for 
Search instead for 
Did you mean: 

Tomcat still crashing on 3.4c even after PDFBox/Fontbox fix

icrew
Champ in-the-making
Champ in-the-making
Hi all:

I'm having real trouble with tomcat crashing on my 3.4c install.  Sometimes the crash happens a couple of minutes after I start it, sometimes it can be several hours.  There doesn't appear to be a consistent cause–the crashes can happen even when I *know* no one is accessing the system.  The pattern seems to be that it'll crash very shortly after I restart it for several hours, then, at a certain point, it'll decide to start behaving for a while and stay up for several hours after I restart it.

Sometimes it just crashes silently (nothing in catalina.out), other times I get one of the SIGSEGV errors like:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xb7dd5120, pid=13764, tid=2134440848
#
# JRE version: 6.0_27-b07
# Java VM: Java HotSpot(TM) Server VM (20.2-b06 mixed mode linux-x86 )
# Problematic frame:
# C  [libc.so.6+0x69120]  _int_free+0x250
#
# An error report file with more information is saved as:
# /opt/alfresco/hs_err_pid13764.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#

I've already tried upgrading PDFBox and FontBox to version 1.6.0, as suggested in other threads, and I've also upgraded Java to 6.0.26.  Upgrading to PDFBox and FontBox seemed to help for a while (a couple of months), but the crashes are back again, and I can't for the life of me figure out why.


$ ls ./tomcat/webapps/alfresco/WEB-INF/lib/*box*
./tomcat/webapps/alfresco/WEB-INF/lib/fontbox-1.6.0.jar          ./tomcat/webapps/alfresco/WEB-INF/lib/pdfbox-1.6.0.jar

I've also checked the recently-uploaded PDF files for security (as suggested in the last post at https://forums.alfresco.com/en/viewtopic.php?p=109821), and there isn't any security on them….

I'm using Centos 5.5 and the mysql, etc. that came with the standard 3.4c install.

One thing I have noticed is that the tomcat java process seems to be taking a bunch of CPU time/CPU percentage when I look at it in "top," but I'm not sure if that's unusual or indicative of a problem.  For example, the following is the "top" output right now.  Tomcat has been up for about 12 minutes at this point:


$ top -bn1
top - 08:42:10 up 21:21,  1 user,  load average: 0.01, 0.25, 0.94
Tasks:  25 total,   1 running,  24 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.7%us,  6.7%sy,  0.0%ni, 92.6%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2097152k total,  1423856k used,   673296k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                             
    1 root      18   0  2156  668  572 S  0.0  0.0   0:04.71 init                                                                                                
1108 root      21  -4  2248  552  344 S  0.0  0.0   0:00.00 udevd                                                                                               
1429 named     18   0  110m 4780 2044 S  0.0  0.2   0:00.60 named                                                                                               
1465 root      15   0  7212 1048  656 S  0.0  0.0   0:00.03 sshd                                                                                                
1474 root      25   0  2832  872  700 S  0.0  0.0   0:00.00 xinetd                                                                                              
1720 root      15   0  6964 1772 1408 S  0.0  0.1   0:00.53 master                                                                                              
1727 postfix   15   0  7204 1900 1472 S  0.0  0.1   0:00.27 qmgr                                                                                                
1731 root      18   0 34536  15m 9096 S  0.0  0.7   0:00.99 httpd                                                                                               
1739 root      15   0  3332 1108  572 S  0.0  0.1   0:00.02 crond                                                                                               
1747 root      18   0  5696  708  432 S  0.0  0.0   0:00.00 saslauthd                                                                                           
1748 root      19   0  5696  428  152 S  0.0  0.0   0:00.00 saslauthd                                                                                           
3183 root      15   0  9796 2576 2104 S  0.0  0.1   0:00.04 sshd                                                                                                
3187 aurea     15   0  9956 1396  876 S  0.0  0.1   0:00.22 sshd                                                                                                
3188 aurea     15   0  2680 1448 1144 S  0.0  0.1   0:00.08 bash                                                                                                
11600 aurea     15   0  179m  58m  45m S  0.0  2.9   0:00.80 soffice.bin                                                                                         
11674 apache    15   0 34672 9228 2556 S  0.0  0.4   0:00.26 httpd                                                                                               
11834 aurea     18   0  2496 1096  924 S  0.0  0.1   0:00.00 mysqld_safe                                                                                         
11947 aurea     16   0  119m  25m 4976 S  0.0  1.3   0:21.70 mysqld.bin                                                                                          
14284 aurea     21   0 1011m 505m 8372 S  0.0 24.7   2:21.91 java                                                                                                
15481 apache    18   0 34672 8968 2308 S  0.0  0.4   0:00.03 httpd                                                                                               
15483 apache    17   0 34672 8980 2316 S  0.0  0.4   0:00.03 httpd                                                                                               
15490 apache    15   0 34672 8724 2080 S  0.0  0.4   0:00.00 httpd                                                                                               
15495 apache    15   0 34672 8724 2088 S  0.0  0.4   0:00.00 httpd                                                                                               
15525 postfix   15   0  7028 1732 1388 S  0.0  0.1   0:00.00 pickup                                                                                              
15549 aurea     15   0  2284  908  724 R  0.0  0.0   0:00.00 top                                                                                                 

I'm really stumped.  Any ideas would be MOST appreciated.

Thanks!

Ian
2 REPLIES 2

irvingpop
Champ in-the-making
Champ in-the-making
Ditch the included Java.   In my experience, standard Sun Java (now 1.6.26) is much more stable and stopped Alfresco crashing issues for me.

Same goes for the other binaries included by Alfresco, especially OpenOffice and pdf2swf.

cbernardi
Champ in-the-making
Champ in-the-making
Hi, same problem, Centos 64bit, Alfresco-4.0.d.
In this distribution PdfBox and FontBox already are updated as suggested by other users.

Uploading, showing file in search result or visiting preview page of particular PDF's caused tomcat (JVM) crash with no indication in log file.

After a research, it turned out it's PdfRenderer (in my installation PdfRenderer-0.9.1.jar)
(see this issue, I've reported here my solution:  http://java.net/jira/browse/PDF_RENDERER-127)

So, I've solved downloading PdfRenderer source and editing class com.sun.pdfview.PDFRenderer in this way:

substitute method with:

private BasicStroke autoAdjustStrokeWidth(Graphics2D g, BasicStroke bs) {
        AffineTransform bt = new AffineTransform(g.getTransform());
        float width = bs.getLineWidth() * (float) bt.getScaleX();
        BasicStroke stroke = bs;
        if (width < 1f) {
            if (bt.getScaleX() > 0.01) {
                width = 1.0f / (float) bt.getScaleX();
            } else {
                // prevent division by a really small number
                width = 1.0f;
            }
        }
                stroke = new BasicStroke(width,
                bs.getEndCap(),
                bs.getLineJoin(),
                bs.getMiterLimit(),
                getDashArray(bs),
                bs.getDashPhase());

        return stroke;
    }

and add this method:

private float[] getDashArray(BasicStroke bs) {
                float[] dashArray = bs.getDashArray();

                if (dashArray != null) {
                        int arrayLength = dashArray.length;
                        float dash;
                        for (int i = 0; i<arrayLength; i++) {
                                dash = dashArray[i];
                                if (dash == 1.0E-5f) {
                                        dashArray[i] = 0.01f;
                                }
                        }
                }
                return dashArray;
        }
       
I've compiled the jar and substitute in alfresco library.

Hope this helps