Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8019366

ThreadInfo.toString always cuts off the stack trace after 8 elements

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: P3 P3
    • None
    • 7u21
    • core-svc

      FULL PRODUCT VERSION :
      java version " 1.7.0_21 "
      Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
      Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
        To my horror, when debugging a program just now, I found that ThreadInfo.toString always cuts off the stack trace after 8 elements.

      In my case today, this bug caused it to not print out critical information that I needed for debugging. (The thread was deep into some low level library I/O code, so the crucial stack elements from my application classes were missed.)

      Looking at the source code for ThreadInfo.toString, the bug is obvious: it drops all stack trace elements with an index > MAX_FRAMES (it summarizes them all as " ... " ).

      The problem is that MAX_FRAMES is a private static final constant set to 8.

      There are a couple of possible solutions:

      1) drop that stupid MAX_FRAMES functionality altogether
      2) add a static setter method so that users can configure MAX_FRAMES
      3) have a toString method that takes an int arg which overides MAX_FRAMES

      ThreadInfo


      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Copy the ThreadInfo.toString source code and manually rip out the MAX_FRAMES limitation.

      Besides having to do this, this solution is very bad because it only works for code under my control, and not for 3rd party code.

            keshah Ketan Shah (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: