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

Sometimes different threads have same hashCode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • 6
    • 6
    • hotspot
    • None
    • x86
    • solaris_2.4

      Customer has a specific double-processor Linux machine (Linux bmjots2 2.4.26-ots #1 SMP Mon Jun 7 10:39:41 CEST 2004 i686 GNU/Linux) on which we experience the phenomenon that

        System.identityHashCode(Thread.currentThread())

      sometimes gives identical values when executed on different threads. (While I know that System.identityHashCode is not required to return different values for different objects, I think that the actual implementation *does* have this property, and, unfortunately, parts of StarOffice/OpenOffice rely on this. The customer uses StarOffice/OpenOffice to build his solution on top of it.)

      The attached program illustrates the problem, the following output is directly from the customer:

      cajus@bmjots2:~$ while true; do /opt/j2re1.4.2_04/bin/java Test2 || break; done
      OK: 18464898 != 28168925
      OK: 18464898 != 28168925
      OK: 18464898 != 28168925
      OK: 18464898 != 28168925
      OK: 18464898 != 28168925
      OK: 18464898 != 28168925
      BUG: 18464898 == 18464898
      main_thread = Thread[main,5,], cur = Thread[Thread-0,5,main], EQ ? false
      cajus@bmjots2:~$

            hhuangsunw Hui Huang (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: