Edward Sargisson created LOG4J2-278:
---------------------------------------

             Summary: Embedded Flume agent fails to rollback
                 Key: LOG4J2-278
                 URL: https://issues.apache.org/jira/browse/LOG4J2-278
             Project: Log4j 2
          Issue Type: Bug
          Components: Flume Appender
    Affects Versions: 2.0-beta7
            Reporter: Edward Sargisson
         Attachments: flume-embedded-web-flume-2067.tar.gz

If the embedded Flume agent decides to rollback (for example, because the 
succeeding node is full) then that rollback fails.

Steps:
1. Setup a Flume agent as the succeeding agent and convince it to fill its 
queue. (In my case, I can make it run out of memory then the queue fills which 
makes it refuse to accept more messages.)
2. Extract the attached code (a very simple Jetty server) and modify the 
log4j2.xml to have embedded=true for the FlumeAppender
3. Run the attached code

Expected result:
The embedded agent should queue messages.

Actual result:
2013-06-10 14:39:11,173 ERROR An exception occurred processing Appender 
FlumeAppender java.lang.IllegalStateException: rollback() called when 
transaction is COMPLETED! identityHashCode=1164913745
        at 
com.google.common.base.Preconditions.checkState(Preconditions.java:172)
        at 
org.apache.flume.channel.BasicTransactionSemantics.rollback(BasicTransactionSemantics.java:171)
        at 
org.apache.flume.channel.ChannelProcessor.processEvent(ChannelProcessor.java:269)
        at 
org.apache.logging.log4j.flume.appender.Log4jEventSource.send(Log4jEventSource.java:59)
        at 
org.apache.logging.log4j.flume.appender.FlumeEmbeddedManager.send(FlumeEmbeddedManager.java:123)
        at 
org.apache.logging.log4j.flume.appender.FlumeAppender.append(FlumeAppender.java:86)
        at 
org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:102)
        at 
org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:424)
        at 
org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:405)
        at 
org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:366)
        at org.apache.logging.log4j.core.Logger.log(Logger.java:110)
        at 
org.apache.logging.log4j.spi.AbstractLoggerWrapper.log(AbstractLoggerWrapper.java:55)
        at org.slf4j.impl.SLF4JLogger.debug(SLF4JLogger.java:139)
        at org.apache.flume.channel.file.Log.rollback(Log.java:566)
        at 
org.apache.flume.channel.file.FileChannel$FileBackedTransaction.doRollback(FileChannel.java:590)
        at 
org.apache.flume.channel.BasicTransactionSemantics.rollback(BasicTransactionSemantics.java:179)
        at org.apache.flume.sink.AvroSink.process(AvroSink.java:316)
        at 
org.apache.flume.sink.FailoverSinkProcessor.process(FailoverSinkProcessor.java:182)
        at org.apache.flume.SinkRunner$PollingRunner.run(SinkRunner.java:147)
        at java.lang.Thread.run(Thread.java:722)


(note the identityHashCode is from my own modifications for debugging but does 
not affect this repro).

The problem is in org.apache.flume.channel.file.Log line 566 where, during a 
rollback, it logs that it's rolling back. Flume transactions are held in a 
thread local. That transaction is open, then the rollback is attempted, which 
hits Log line 566, so a log write is attempted, which gets the same 
transaction, which is already open, which causes the exception.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to