-
Bug
-
Resolution: Fixed
-
P1
-
1.4.1, 1.4.1_01a, 1.4.2
-
03
-
generic, sparc
-
generic, solaris_8
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2117809 | 5.0 | John Rose | P1 | Resolved | Fixed | tiger |
JDK-2117808 | 1.4.2 | John Rose | P1 | Resolved | Fixed | b18 |
09/10/2002 11:17:47
===============================================
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) 64-Bit Server VM (build 1.4.1_01-b01, mixed mode)
com.adventnet.snmp.snmp2.agent.AgentRuntimeException: Failure in opening SnmpSession, errstat: 0, errvalue: 0
at com.adventnet.snmp.snmp2.agent.SnmpAgent.addClientAndOpenSession(SnmpAgent.java:801)
at com.adventnet.snmp.snmp2.agent.SnmpAgent.restartSnmpAgent(SnmpAgent.java:939)
at com.adventnet.snmp.snmp2.agent.SnmpAgent.restartSnmpAgent(SnmpAgent.java:955)
at com.adventnet.snmp.snmp2.agent.SnmpAgent.setPort(SnmpAgent.java:1034)
at com.xacct.xacctusage.util.xmi.snmpagent.XacctUsage.initXacctUsage(XacctUsage.java:250)
at com.xacct.xacctusage.util.xmi.snmpagent.XacctUsage.init(XacctUsage.java:320)
at com.xacct.xacctusage.core.Application$1.run(Application.java:897)
at java.lang.Thread.run(Thread.java:536)
CSVLogReader.CreateMapArguments() - Exception !!!
java.lang.NullPointerException
All files mentioned in the description are in the attachments
Problem description :
------------------------------
We have CSVLogReader.class that performs CSV file line parsing . After
reading the line from the file, the CreateMapArguments(String line)
method is called in order to put each field to the buffer according to its
type. Inside this method there is a try/catch (Exception E) block, that
sometimes
catches NullPointerException. In order to understand the reason, we've
inserted E.printStackTrace() call, and we've expected to see the stack trace
for this
Exception object in the standard output. But only
"java.lang.NullPointerException" was printed. So the first question is: why
we didn't see the full stack trace ?
Using
Throwable X = E.fillInStackTrace();
X.printStackTrace();
gives the same results.
Then we've concluded that the only way to see what object caused the
NullPointerException is to produce a thread dump immediately after catching
the exception.
From the program we called to a script that sent kill -QUIT signal to the
process. The results of the thread point that the source of this Exception
is inside Java classes.
Examples
---------------
Here are some examples from several thread dumps that show the threads which
called to the CreateMapArguments() method:
1. Thread dump from gath7_stdout.log
"Thread-24" prio=5 tid=0x1053d0680 nid=0x4a runnable
[fffffffec7a00000..fffffffec7a014a0]
at
ISM.ISM_114_1_0.CSVFieldTokenizer.fieldAsString(CSVFieldTokenizer.java:161)
at ISM.ISM_114_1_0.CSVLogReader.CreateMapArguments(CSVLogReader.java:426)
at ISM.ISM_114_1_0.CSVLogReader.processRecord(CSVLogReader.java:333)
at ISM.ISM_114_1_0.LogReader.readNewLines(LogReader.java:575)
at ISM.ISM_114_1_0.LogReader.run(LogReader.java:484)
- locked <fffffffee8b85858> (a ISM.ISM_114_1_0.CSVLogReader)
Here is the ISM.ISM_114_1_0.CSVFieldTokenizer.fieldAsString() method with
line 161 specified:
public String fieldAsString(int FieldNo)
{
char[] arr = new char[m_FieldLen[FieldNo]]; // line 161
System.arraycopy(m_Buffer[FieldNo], 0, arr, 0, m_FieldLen[FieldNo]);
return (new String(arr));
}
As you can see, no our objects were called in this line.
The same situation we can see in the gath9_stdout.log :
"Thread-15" prio=5 tid=0x1055f2180 nid=0x30 runnable
[fffffffecae00000..fffffffecae014a0]
at
ISM.ISM_114_1_0.CSVFieldTokenizer.fieldAsString(CSVFieldTokenizer.java:161)
at ISM.ISM_114_1_0.CSVLogReader.CreateMapArguments(CSVLogReader.java:426)
at ISM.ISM_114_1_0.CSVLogReader.processRecord(CSVLogReader.java:333)
at ISM.ISM_114_1_0.LogReader.readNewLines(LogReader.java:575)
at ISM.ISM_114_1_0.LogReader.run(LogReader.java:484)
- locked <fffffffee8b86ef8> (a ISM.ISM_114_1_0.CSVLogReader)
2. Thread dump from gath17_stdout.log
"Thread-26" prio=5 tid=0x1002eb170 nid=0x53 runnable
[fffffffec6600000..fffffffec66014a0]
at java.lang.Integer.intValue(Integer.java:591)
at Util.MapArguments.putString(MapArguments.java:889)
at ISM.ISM_114_1_0.CSVLogReader.CreateMapArguments(CSVLogReader.java:426)
at ISM.ISM_114_1_0.CSVLogReader.processRecord(CSVLogReader.java:333)
at ISM.ISM_114_1_0.LogReader.readNewLines(LogReader.java:575)
at ISM.ISM_114_1_0.LogReader.run(LogReader.java:484)
- locked <fffffffee8b85070> (a ISM.ISM_114_1_0.CSVLogReader)
Here is the Util.MapArguments.putString() method with line 889 specified:
public void putString(Integer Key, String Value)
{
putString(Key.intValue(), Value); // line 889
}
As you can see, the Integer.intValue() method is called before Exception was
thrown.
3. Thread dump from gath20_stdout.log
"Thread-24" prio=5 tid=0x100301430 nid=0x44 runnable
[fffffffec8400000..fffffffec84014a0]
at java.util.Calendar.complete(Calendar.java:1095)
at java.util.Calendar.get(Calendar.java:942)
at ISM.ISM_114_1_0.SuperParser.parseDateTime(SuperParser.java:286)
at ISM.ISM_114_1_0.CSVLogReader.CreateMapArguments(CSVLogReader.java:476)
at ISM.ISM_114_1_0.CSVLogReader.processRecord(CSVLogReader.java:333)
at ISM.ISM_114_1_0.LogReader.readNewLines(LogReader.java:575)
at ISM.ISM_114_1_0.LogReader.run(LogReader.java:484)
- locked <fffffffee81867c8> (a ISM.ISM_114_1_0.CSVLogReader)
The relevant line in the ISM.ISM_114_1_0.SuperParser.parseDateTime() is :
int Year = m_CalObj.get(Calendar.YEAR); // line 286
The same situation we can see in the gath24_stdout.log :
"Thread-23" prio=5 tid=0x1002fa8e0 nid=0x43 runnable
[fffffffec8500000..fffffffec85014a0]
at java.util.Calendar.get(Calendar.java:943)
at ISM.ISM_114_1_0.SuperParser.parseDateTime(SuperParser.java:286)
at ISM.ISM_114_1_0.CSVLogReader.CreateMapArguments(CSVLogReader.java:476)
at ISM.ISM_114_1_0.CSVLogReader.processRecord(CSVLogReader.java:333)
at ISM.ISM_114_1_0.LogReader.readNewLines(LogReader.java:575)
at ISM.ISM_114_1_0.LogReader.run(LogReader.java:484)
- locked <fffffffee8181e08> (a ISM.ISM_114_1_0.CSVLogReader)
As you can see, the Calendar m_CalObj method is not null here, and the
problem is in the Calendar methods.
4. Thread dump from gath28_stdout.log
"Thread-30" prio=5 tid=0x105562140 nid=0x52 runnable
[fffffffec6f00000..fffffffec6f014a0]
at Util.MapArguments.putString(MapArguments.java:903)
at Util.MapArguments.putString(MapArguments.java:889)
at ISM.ISM_114_1_0.CSVLogReader.CreateMapArguments(CSVLogReader.java:426)
at ISM.ISM_114_1_0.CSVLogReader.processRecord(CSVLogReader.java:333)
at ISM.ISM_114_1_0.LogReader.readNewLines(LogReader.java:575)
at ISM.ISM_114_1_0.LogReader.run(LogReader.java:484)
- locked <fffffffee8b814a0> (a ISM.ISM_114_1_0.CSVLogReader)
The relevant line in the Util.MapArguments.putString() is :
m_StringErr [KeyDesc.Index] = NO_ERROR; // line 903
The m_StringErr is a array of booleans.
How do you explain this situation ? What object can cause the
NullPointerException ? And why we can't see the stack trace
by using printStackTrace() call ?
Attached with this email :
1. All mentioned thread dumps (gath7_stdout.log, gath9_stdout.log,
gath17_stdout.log, gath20_stdout.log, gath24_stdout.log, gath28_stdout.log)
.
2. The CSVLogReader source file.
- backported by
-
JDK-2117808 NullPointerException just before data loss
-
- Resolved
-
-
JDK-2117809 NullPointerException just before data loss
-
- Resolved
-
- duplicates
-
JDK-4793625 iMM4.5 on S1Appserver gave NPE with 1.4.2 Build 10 in C2 mode
-
- Closed
-
- relates to
-
JDK-4684993 jdk1.4.1 b11 crashes iAS7/TPC-W
-
- Resolved
-
-
JDK-4807707 osr compile problem with jdk 1.4.1, 1.4.1_01 and 1.4.2-b11
-
- Resolved
-
-
JDK-6272923 CI wrongly reports array class as unloaded after constrained klass is reported as loaded
-
- Resolved
-
-
JDK-6913410 Crash: class resolution triggered within hotspot compiler.
-
- Closed
-
-
JDK-4292742 NullPointerException with no stack trace
-
- Resolved
-