[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/22741] LogManager.findAncestor throws exception if a logg
From: |
gcc-bugzilla at gcc dot gnu dot org |
Subject: |
[Bug classpath/22741] LogManager.findAncestor throws exception if a logger has been garbage collected |
Date: |
16 Oct 2005 01:26:56 -0000 |
Because the LogManager maintains a copy of all loggers as weak references,
loggers can be garbage collected.
This means that if a logger is GC'd, the next time the logger is looked up (via
Logger.getLogger), an ArrayIndexOutOfBounds exception will be thrown in the
charAt(candNameLength) statement, because candName and child will reference the
same logger [at some point], thus candNameLength == childName.length(),
therefore, childName.charAt(candNameLength) is out of bounds.
------- Comment #1 from from-classpath at savannah dot gnu dot org 2004-05-14
18:39 -------
Submitter:
Would you be able to provide a test case that demonstrates this bug so that we
can make sure that it is fixed properly?
------- Comment #2 from from-classpath at savannah dot gnu dot org 2004-05-17
19:09 -------
Sure... Attached is a sample program [it also highlights another error].
Below is the output of the runs of the program.
We are working with the IBM RVM. The RVM has issues with regards to obtaining
java.lang.StackTraceElements, so I had to modify java.util.logging.Logger to
return a null ptr in the getCallerStackFrame method, and then allow for a null
"caller" in the various log() methods. These methods put in ?? for the class
name/method name if the stack frame can't be located.
The parameter to the program is a boolean ["true"|"false"]. True indicates
that we will keep a reference to the logger, thus prohibiting GC. False
indicates that we will not keep a reference to the logger, thus suggesting GC.
address@hidden JikesRVM]$ rvm LoggerError true
17-May-04 2:43:21 PM ?? ??
WARNING: Test Message
17-May-04 2:43:22 PM ?? ??
WARNING: Test Message 2
address@hidden JikesRVM]$ rvm LoggerError false
17-May-04 2:43:27 PM ?? ??
WARNING: Test Message
Ljava/lang/StringIndexOutOfBoundsException;: String index out of range: 10
VM_StackTrace.print(): Printing Stack Trace # 10
[Here is the context of the attempt to print stack trace #:10
-- Stack --
Lcom/ibm/JikesRVM/VM_StackTrace;
print(Lcom/ibm/JikesRVM/PrintLN;Ljava/lang/Throwable;Ljava/lang/Throwable;I)V
at line 246
Ljava/lang/Throwable;
doPrintStackTrace(Lcom/ibm/JikesRVM/PrintLN;Ljava/lang/Throwable;I)V at line
261
Ljava/lang/Throwable;
printStackTrace(Lcom/ibm/JikesRVM/PrintLN;Ljava/lang/Throwable;I)V at line 230
Ljava/lang/Throwable; printStackTrace(Lcom/ibm/JikesRVM/PrintLN;I)V at line
210
Ljava/lang/Throwable; printStackTrace(Ljava/io/PrintStream;I)V at line 345
Ljava/lang/Throwable; printStackTrace(I)V at line 189
Ljava/lang/Throwable; printStackTrace()V at line 157
Lcom/ibm/JikesRVM/VM_Runtime;
deliverException(Ljava/lang/Throwable;Lcom/ibm/JikesRVM/VM_Registers;)V at line
923
Lcom/ibm/JikesRVM/VM_Runtime; athrow(Ljava/lang/Throwable;)V at line 616
Ljava/util/logging/Logger;
getLogger(Ljava/lang/String;Ljava/lang/String;)Ljava/util/logging/Logger; at
line 285
Ljava/util/logging/Logger;
getLogger(Ljava/lang/String;)Ljava/util/logging/Logger; at line 210
LLoggerError; getLogger()Ljava/util/logging/Logger; at line 8
LLoggerError; main([Ljava/lang/String;)V at line 34
Lcom/ibm/JikesRVM/MainThread; run()V at line 92
Lcom/ibm/JikesRVM/VM_Thread; startoff()V at line 789
... END context of the attempt to print Stack Trace # 10]
at java.lang.String.charAt(String.java:491)
at java.util.logging.LogManager.findAncestor(LogManager.java:369)
at java.util.logging.LogManager.addLogger(LogManager.java:302)
at java.util.logging.Logger.getLogger(Logger.java:293)
at java.util.logging.Logger.getLogger(Logger.java:210)
at LoggerError.getLogger(LoggerError.java:8)
at LoggerError.main(LoggerError.java:34)
at com.ibm.JikesRVM.MainThread.run(MainThread.java:92)
JikesRVM: exit 113
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22741
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug classpath/22741] LogManager.findAncestor throws exception if a logger has been garbage collected,
gcc-bugzilla at gcc dot gnu dot org <=