Bug 535575 (RHQ-2256)

Summary: log4j error thrown when running 'quit' on agent in Solaris
Product: [Other] RHQ Project Reporter: Corey Welton <cwelton>
Component: No ComponentAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: low    
Version: 1.3preCC: ccrouch, jshaughn
Target Milestone: ---Keywords: SubBug
Target Release: ---   
Hardware: All   
OS: All   
URL: http://jira.rhq-project.org/browse/RHQ-2256
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
SunOS sun-netra-04.idm.lab.bos.redhat.com 5.9 Generic_122300-08 sun4u sparc SUNW,Netra-210 java version "1.6.0_14" Java(TM) SE Runtime Environment (build 1.6.0_14-b08) Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)
Last Closed: 2014-05-02 13:51:46 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 565628    

Description Corey Welton 2009-07-22 13:48:00 EDT
When shutting down agent in Solaris, log4j error is thrown.  This seems like a regression, I don't remember seeing this in earlier releases.

1. Install agent
2. Let agent run long enough to get the ">" prompt
3. 'quit'
4. View results

Expected results:  Clean shutdown

Current results:

bash-2.05# ./rhq-agent/bin/rhq-agent.sh 
RHQ 1.3.0-SNAPSHOT [4508] (Tue Jul 21 08:59:45 PDT 2009)
> quit
Agent no longer accepting input at prompt.
Shutting down...
log4j:ERROR Failed to flush writer,
        at java.io.FileOutputStream.writeBytes(Native Method)
        at java.io.FileOutputStream.write(Unknown Source)
        at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
        at sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source)
        at sun.nio.cs.StreamEncoder.implFlush(Unknown Source)
        at sun.nio.cs.StreamEncoder.flush(Unknown Source)
        at java.io.OutputStreamWriter.flush(Unknown Source)
        at org.apache.log4j.helpers.QuietWriter.flush(QuietWriter.java:57)
        at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:315)
        at org.apache.log4j.RollingFileAppender.subAppend(RollingFileAppender.java:236)
        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.Category.callAppenders(Category.java:203)
        at org.apache.log4j.Category.forcedLog(Category.java:388)
        at org.apache.log4j.Category.info(Category.java:663)
        at mazz.i18n.log4j.Log4jLogMsg.info(Log4jLogMsg.java:638)
        at mazz.i18n.log4j.Log4jLogger.info(Log4jLogger.java:270)
        at org.rhq.enterprise.agent.PrimaryServerSwitchoverThread.run(PrimaryServerSwitchoverThread.java:132)
The agent will wait for [0] threads to die
Shutdown complete - agent will now exit.

Other notes:

[12:47] <mazz> this doesn't look bad. you are in the middle of shutting down - when the agent is shutting down, it             
               sends interrupts to all its threads (including this primary switchover thread) so those threads                 
               know, "we are shutting down, everyone stop what you are doing and exit"                                         
[12:48] <mazz> this is just that you happened to interrupt right before or during the time a log message was                   
               getting written out                                                                                             
[12:48] <cswiii> seems to happen every single time i 'quit'                                                                    
[12:49] <cswiii> would i be interrupting logwriting every time?                                                                
[12:49] <cswiii> maybe i'll let this run for a while and see                                                                   
[12:49] <mazz> might be due to the way solaris and the native NIO is implemented                                               
[12:49] <mazz> and how it works with the way log4j is using it                                                                 
[12:50] <mazz> but for sure the shutdown is cause - we are really interruptting it 
Comment 1 John Mazzitelli 2009-07-22 14:32:50 EDT
this is a stack thrown from  log4j when agent is shutting down. Its a minor issue since nothing bad is really happening, its just a log message at shutdown due to the shutdown interrupts
Comment 2 John Mazzitelli 2009-07-22 14:35:39 EDT
well, not just a log message, if running in foreground, its a stdout message
Comment 3 Red Hat Bugzilla 2009-11-10 16:00:55 EST
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-2256
Comment 4 wes hayutin 2010-02-16 11:58:01 EST
Temporarily adding the keyword "SubBug" so we can be sure we have accounted for all the bugs.

new = Tracking + FutureFeature + SubBug
Comment 5 wes hayutin 2010-02-16 12:02:58 EST
making sure we're not missing any bugs in rhq_triage
Comment 6 Joseph Marques 2010-11-17 12:40:36 EST
interesting race condition.  agreed, that's it's low priority due to the timing and the fact that the agent is already being shut down.  however, it could be alarming to users.  it should be fixed.
Comment 7 Corey Welton 2010-11-22 14:43:30 EST
Triaged 17-Nov