commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commit-cp] [bugs #8921] LogManager.findAncestor throws exception if a l


From: Michael Koch
Subject: [commit-cp] [bugs #8921] LogManager.findAncestor throws exception if a logger has been garbage collected
Date: Tue, 11 Jan 2005 12:46:14 +0000
User-agent: Mozilla/5.0 (compatible; Konqueror/3.3; Linux; X11; i686; de) (KHTML, like Gecko)

This is an automated notification sent by Savannah.
It relates to:
                bugs #8921, project classpath

==============================================================================
 LATEST MODIFICATIONS of bugs #8921:
==============================================================================

               Posted by: Michael Koch <mkoch>
               Posted on: 2005-01-11 12:46 (GMT)
    _______________________________________________________

                Category:                    None -> classpath              


==============================================================================
 OVERVIEW of bugs #8921:
==============================================================================

URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=8921>

                 Summary: LogManager.findAncestor throws exception if a
logger has been garbage collected
                 Project: classpath
            Submitted by: None
            Submitted on: Mit 12.05.2004 um 21:45
                Category: classpath
                Severity: 5 - Average
                  Status: None
                 Privacy: Public
             Assigned to: saugart
             Open/Closed: Open
        Platform Version: None

    _______________________________________________________


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.

    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Mon 17.05.2004 um 19:09       By: Keven Ring <keven>
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





-------------------------------------------------------
Date: Fre 14.05.2004 um 18:39       By: Steven Augart <saugart>
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?









    _______________________________________________________

Carbon-Copy List:

CC Address                          | Comment
------------------------------------+-----------------------------
address@hidden                     | 



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon 17.05.2004 um 19:09  Name: LoggerError.java  Size: 1022B   By:
keven
Program to reproduce Logging error after GC occurs
<http://savannah.gnu.org/bugs/download.php?item_id=8921&item_file_id=1314>

==============================================================================

This item URL is:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=8921>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]