log4j DailyRollingFileAppender error in JBoss EAP 4.3 with JVM 1.5_09

Solution Verified - Updated -

Issue

  • We recently migrated to JBOSS 4.3 with java version 1.5_09.
  • We are observing issues related to logging.
  • Exactly at midnight during log file roll over, we see the below error in server.log .
  • This issue is random though it happens frequently.
  • Once the error is encountered it never recovers until restarted.
  • Our jboss is running on SunOS/Solaris.
2012-08-19 00:00:00,442 ERROR [STDERR] Exception in thread "Dispatcher-Thread-31" 
2012-08-19 00:00:00,442 ERROR [STDERR] java.lang.IllegalStateException: Current state = FLUSHED, new state = CODING_END
2012-08-19 00:00:00,443 ERROR [STDERR]  at java.nio.charset.CharsetEncoder.throwIllegalStateException(CharsetEncoder.java:941)
2012-08-19 00:00:00,443 ERROR [STDERR]  at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:537)
2012-08-19 00:00:00,443 ERROR [STDERR]  at sun.nio.cs.StreamEncoder$CharsetSE.flushLeftoverChar(StreamEncoder.java:358)
2012-08-19 00:00:00,443 ERROR [STDERR]  at sun.nio.cs.StreamEncoder$CharsetSE.implClose(StreamEncoder.java:414)
2012-08-19 00:00:00,443 ERROR [STDERR]  at sun.nio.cs.StreamEncoder.close(StreamEncoder.java:160)
2012-08-19 00:00:00,443 ERROR [STDERR]  at java.io.OutputStreamWriter.close(OutputStreamWriter.java:222)
2012-08-19 00:00:00,443 ERROR [STDERR]  at java.io.FilterWriter.close(FilterWriter.java:92)
2012-08-19 00:00:00,443 ERROR [STDERR]  at org.apache.log4j.FileAppender.closeFile(FileAppender.java:183)
2012-08-19 00:00:00,443 ERROR [STDERR]  at org.apache.log4j.FileAppender.reset(FileAppender.java:338)
2012-08-19 00:00:00,443 ERROR [STDERR]  at org.apache.log4j.FileAppender.setFile(FileAppender.java:283)
2012-08-19 00:00:00,443 ERROR [STDERR]  at org.apache.log4j.DailyRollingFileAppender.rollOver(DailyRollingFileAppender.java:330)
2012-08-19 00:00:00,443 ERROR [STDERR]  at org.apache.log4j.DailyRollingFileAppender.subAppend(DailyRollingFileAppender.java:352)
2012-08-19 00:00:00,444 ERROR [STDERR]  at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)
2012-08-19 00:00:00,444 ERROR [STDERR]  at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
2012-08-19 00:00:00,444 ERROR [STDERR]  at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
2012-08-19 00:00:00,444 ERROR [STDERR]  at org.apache.log4j.AsyncAppender$Dispatcher.run(AsyncAppender.java:578)
  • After this error, all the subsequent write to the file fails with below error
java.lang.IllegalStateException: Current state = FLUSHED, new state = CODING
        at java.nio.charset.CharsetEncoder.throwIllegalStateException(CharsetEncoder.java:941)
        at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:537)
        at sun.nio.cs.StreamEncoder$CharsetSE.implWrite(StreamEncoder.java:384)
        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:136)
        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:146)
        at java.io.OutputStreamWriter.write(OutputStreamWriter.java:204)
        at java.io.Writer.write(Writer.java:126)
        at org.apache.log4j.helpers.QuietWriter.write(QuietWriter.java:47)
        at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:301)
        at org.apache.log4j.DailyRollingFileAppender.subAppend(DailyRollingFileAppender.java:358)
        at org.apache.log4j.WriterAppender.append(WriterAppender.java:159)
        at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
        at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
        at org.apache.log4j.AsyncAppender.append(AsyncAppender.java:146)
        at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
        at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
        at org.apache.log4j.Category.callAppenders(Category.java:203)
        at org.apache.log4j.Category.forcedLog(Category.java:388)
        at org.apache.log4j.Category.info(Category.java:663)
        at aaa.bbb.stream.StaxSOAPServlet.doPost(StaxSOAPServlet.java:111)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 4.3.0.GA_CP10

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In