Bug 567481 - Agent on Solaris 10: Failed to execute prompt command [discovery -f]. Cause: java.lang.NullPointerException:null
Agent on Solaris 10: Failed to execute prompt command [discovery -f]. Cause: ...
Product: RHQ Project
Classification: Other
Component: Agent (Show other bugs)
All Linux
medium Severity medium (vote)
: ---
: ---
Assigned To: Stefan Negrea
Mike Foley
Depends On: 564514
Blocks: ews1.0.2
  Show dependency treegraph
Reported: 2010-02-22 21:17 EST by Ondřej Žižka
Modified: 2011-11-03 16:54 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-11-03 16:54:40 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Attached: Full agent.log (130.89 KB, application/octet-stream)
2010-02-22 21:22 EST, Ondřej Žižka
no flags Details

  None (edit)
Description Ondřej Žižka 2010-02-22 21:17:13 EST
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-22 21:22:33 EST
Created attachment 395625 [details]
Attached: Full agent.log
Comment 2 Ondřej Žižka 2010-02-22 21:26:11 EST
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-22 21:30:34 EST
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,
        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-22 21:57:56 EST
Note that the JMX works (jconsole shows the metrics).
Comment 5 Corey Welton 2010-02-23 14:42:44 EST
Comment #3 has been documented at https://bugzilla.redhat.com/show_bug.cgi?id=535575
Comment 6 Corey Welton 2010-09-30 09:50:37 EDT
Mazz, is this same as referenced bug in comment #5?
Comment 7 John Mazzitelli 2010-09-30 09:57:32 EDT
(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 08:17:54 EST
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-17 21:49:03 EDT
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 02:40:53 EDT
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 02:21:23 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.