[ 
https://issues.apache.org/jira/browse/CASSANDRA-12462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15514830#comment-15514830
 ] 

Simon Zhou edited comment on CASSANDRA-12462 at 9/22/16 11:46 PM:
------------------------------------------------------------------

I repro'ed the same issue with C* 2.2.5 and C* 3 should have the same issue.  I 
have a one line patch as attached. cc the original author of this line @jbellis 
to take a look.


was (Author: szhou):
I repro'ed the same issue with C* 2.2.5 and C* 3 should have the same issue.  
This is a one line patch:

>From 65d0c7874147910f0d7785a734519efeb9240d78 Mon Sep 17 00:00:00 2001
From: Simon Zhou <sz...@uber.com>
Date: Thu, 22 Sep 2016 16:35:52 -0700
Subject: [PATCH] Fix NPE when running "nodetool compactionstats"

---
 src/java/org/apache/cassandra/db/compaction/CompactionInfo.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionInfo.java 
b/src/java/org/apache/cassandra/db/compaction/CompactionInfo.java
index 535217f..d83423f 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionInfo.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionInfo.java
@@ -65,7 +65,7 @@ public final class CompactionInfo implements Serializable
 
     public UUID getId()
     {
-        return cfm.cfId;
+        return cfm != null ? cfm.cfId : null;
     }
 
     public String getKeyspace()
-- 
2.9.3


> NullPointerException in CompactionInfo.getId(CompactionInfo.java:65)
> --------------------------------------------------------------------
>
>                 Key: CASSANDRA-12462
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12462
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Compaction
>            Reporter: Jonathan DePrizio
>         Attachments: 0001-Fix-NPE-when-running-nodetool-compactionstats.patch
>
>
> Note: The same trace is cited in the last comment of 
> https://issues.apache.org/jira/browse/CASSANDRA-11961
> I've noticed that some of my nodes in my 2.1 cluster have fallen way behind 
> on compactions, and have huge numbers (thousands) of uncompacted, tiny 
> SSTables (~30MB or so).
> In diagnosing the issue, I've found that "nodetool compactionstats" returns 
> the exception below.  Restarting cassandra on the node here causes the 
> pending tasks count to jump to ~2000.  Compactions run properly for about an 
> hour, until this exception occurs again.  Once it occurs, I see the pending 
> tasks value rapidly drop towards zero, but without any compactions actually 
> running (the logs show no compactions finishing).  It would seem that this is 
> causing compactions to fail on this node, which is leading to it running out 
> of space, etc.
> [redacted]# nodetool compactionstats
> xss =  -ea -javaagent:/usr/share/cassandra/lib/jamm-0.3.0.jar 
> -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms12G -Xmx12G 
> -Xmn1000M -Xss255k
> pending tasks: 5
> error: null
> -- StackTrace --
> java.lang.NullPointerException
>       at 
> org.apache.cassandra.db.compaction.CompactionInfo.getId(CompactionInfo.java:65)
>       at 
> org.apache.cassandra.db.compaction.CompactionInfo.asMap(CompactionInfo.java:118)
>       at 
> org.apache.cassandra.db.compaction.CompactionManager.getCompactions(CompactionManager.java:1405)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at sun.reflect.misc.Trampoline.invoke(Unknown Source)
>       at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
>       at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(Unknown 
> Source)
>       at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(Unknown 
> Source)
>       at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(Unknown Source)
>       at com.sun.jmx.mbeanserver.PerInterface.getAttribute(Unknown Source)
>       at com.sun.jmx.mbeanserver.MBeanSupport.getAttribute(Unknown Source)
>       at 
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(Unknown 
> Source)
>       at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(Unknown Source)
>       at javax.management.remote.rmi.RMIConnectionImpl.doOperation(Unknown 
> Source)
>       at javax.management.remote.rmi.RMIConnectionImpl.access$300(Unknown 
> Source)
>       at 
> javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(Unknown 
> Source)
>       at 
> javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(Unknown 
> Source)
>       at javax.management.remote.rmi.RMIConnectionImpl.getAttribute(Unknown 
> Source)
>       at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
>       at sun.rmi.transport.Transport$1.run(Unknown Source)
>       at sun.rmi.transport.Transport$1.run(Unknown Source)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at sun.rmi.transport.Transport.serviceCall(Unknown Source)
>       at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
>       at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown 
> Source)
>       at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown 
> Source)
>       at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
>       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>       at java.lang.Thread.run(Unknown Source)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to