Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-13368

Exception Stack not Printed as Intended in Error Logs



    • Bug
    • Status: Resolved
    • Low
    • Resolution: Invalid
    • 2.1.x
    • None
    • Low


      There are a number of instances where it appears the programmer intended to print a stack trace in an error message, but it is not actually being printed. For example, in BlacklistedDirectories.java:54:

              catch (Exception e)
                  logger.error("error registering MBean {}", MBEAN_NAME, e);
                  //Allow the server to start even if the bean can't be registered

      The logger will use the second argument for the braces, but will ignore the exception e. It would be helpful to have the stack traces of these exceptions printed. I propose adding a second line that prints the full stack trace: logger.error(e.getMessage(), e);

      On the 2.1 branch, I found 8 instances of these types of messages:

      db/BlacklistedDirectories.java:54:            logger.error("error registering MBean {}", MBEAN_NAME, e);
      io/sstable/SSTableReader.java:512:            logger.error("Corrupt sstable {}; skipped", descriptor, e);
      net/OutboundTcpConnection.java:228:                    logger.error("error processing a message intended for {}", poolReference.endPoint(), e);
      net/OutboundTcpConnection.java:314:                logger.error("error writing to {}", poolReference.endPoint(), e);
      service/CassandraDaemon.java:231:                logger.error("Exception in thread {}", t, e);
      service/CassandraDaemon.java:562:                logger.error("error registering MBean {}", MBEAN_NAME, e);
      streaming/StreamSession.java:512:            logger.error("[Stream #{}] Streaming error occurred", planId(), e);
      transport/Server.java:442:                logger.error("Problem retrieving RPC address for {}", endpoint, e);

      And one where it'll print the toString() version of the exception:

      db/Directories.java:689:            logger.error("Could not calculate the size of {}. {}", input, e);

      I'm happy to create a patch for each branch, just need a little guidance on how to do so. We're currently running 2.1 so I started there.


        1. cassandra-13368-2.1.patch
          11 kB
          Bill Speirs



            Unassigned Unassigned
            wspeirs Bill Speirs
            0 Vote for this issue
            1 Start watching this issue