Bug 567481

Summary: Agent on Solaris 10: Failed to execute prompt command [discovery -f]. Cause: java.lang.NullPointerException:null
Product: [Other] RHQ Project Reporter: Ondřej Žižka <ozizka>
Component: AgentAssignee: Stefan Negrea <snegrea>
Status: CLOSED NOTABUG QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.3CC: lzoubek, mazz, snegrea
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-11-03 20:54:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 564514    
Bug Blocks: 683054    
Attachments:
Description Flags
Attached: Full agent.log none

Description Ondřej Žižka 2010-02-23 02:17:13 UTC
I got the agent to a state when it says  "NPE" for every `discovery -f`.
Log attached. Happened after I restarted Tomcat and JON server.
All three on the same machine - dev13.

Solaris 10 i386
JON 2.3.0.GA, EWS plugin set from the same
Tomcat 6.0.28 from EWS 1.0.1 CR2


----------------------------------------
> discovery -f
Full discovery run in [216] ms
=== Server Scan Inventory Report ===
Start Time:     Feb 22, 2010 9:09:51 PM
Finish Time:    Feb 22, 2010 9:09:51 PM
Resource Count: 0


Failed to execute prompt command [discovery -f]. Cause: java.lang.NullPointerException:null
> 
----------------------------------------

Comment 1 Ondřej Žižka 2010-02-23 02:22:33 UTC
Created attachment 395625 [details]
Attached: Full agent.log

Comment 2 Ondřej Žižka 2010-02-23 02:26:11 UTC
Started to happen after I exposed JMX by editing startup.sh:

JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.port=12123"
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.ssl=false"
export JAVA_OPTS

Comment 3 Ondřej Žižka 2010-02-23 02:30:34 UTC
When shutting down, agent throws InterruptedIOException:

---------------------------------------------------------
Failed to execute prompt command [discovery -f]. Cause: java.lang.NullPointerException:null
> ^CShutting down...
log4j:ERROR Failed to flush writer,
java.io.InterruptedIOException
        at java.io.FileOutputStream.writeBytes(Native Method)
        at java.io.FileOutputStream.write(FileOutputStream.java:260)
        at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)
        at sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(StreamEncoder.java:404)
        at sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:408)
        at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:152)
        at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
        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.
[ozizka@dev13 agent]$
---------------------------------------------------------

Comment 4 Ondřej Žižka 2010-02-23 02:57:56 UTC
Note that the JMX works (jconsole shows the metrics).

Comment 5 Corey Welton 2010-02-23 19:42:44 UTC
Comment #3 has been documented at https://bugzilla.redhat.com/show_bug.cgi?id=535575

Comment 6 Corey Welton 2010-09-30 13:50:37 UTC
Mazz, is this same as referenced bug in comment #5?

Comment 7 John Mazzitelli 2010-09-30 13:57:32 UTC
(In reply to comment #6)
> Mazz, is this same as referenced bug in comment #5?

no, this NPE seems to come from the discovery -f command, not during shutdown.

Comment 8 Charles Crouch 2011-03-08 13:17:54 UTC
This seems related to https://bugzilla.redhat.com/show_bug.cgi?id=564514

Similarly, this needs to be reproduced to see if it is still a problem.

Comment 9 Stefan Negrea 2011-10-18 01:49:03 UTC
The logs posted in comment #2 are fairly clean and I cannot find any NPE. The big exception posted in comment #3 after sending the interrupt key combo should have been resolved by the BZ posted in comment #5.

So, the only thing to still research is the NPE reported before the shutdown. That NPE could have been caused by any plugin, not just Tomcat, since discovery -f executes the discovery process for all the plugins installed. 

I see no attempts to isolate the error (given that JON server, agent and Tomcat were on the same machine). Also, important information such as: JRE version and side effects after the NPE are missing from the description. 

I will attempt to replicate the environment and retest this issue with just Tomcat server and JON agent on the same machine.

Comment 10 Ondřej Žižka 2011-10-18 06:40:53 UTC
The JDK was Sun JDK, likely 1.6.latest - since dev13 is a QA machine whose JDKs are kept up-to-date.

Comment 11 Stefan Negrea 2011-10-19 06:21:23 UTC
I could not replicate the reported problem. With or without the JMX settings there are no NPE reported in the agent logs or console. 

Please retest.