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

Test hotspot/jtreg/runtime/jni/terminatedThread/TestTerminatedThread.java fails on Alpine Linux

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • repo-portola
    • repo-portola
    • hotspot
    • None
    • x86_64
    • other

      JDK-8205878 adds check that pthread_getcpuclockid() can return ESRCH for invalid thread id [1].
      According to the specification: "ERRORS ESRCH No thread with the ID thread could be found."

      This works because pthread_getcpuclockid() in glibc checks the passed thread id [2], [3].

      However, this is not the case for musl libc which does not check the passed thread id [4]. For more details see discussion on musl mail list [5].

      It looks like the thread id needs to be checked to be valid for muls libc.

      [1] https://hg.openjdk.java.net/jdk/jdk/file/e6336e3c5984/src/hotspot/os/linux/os_linux.cpp#l5736
      [2] https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/pthread_getcpuclockid.c;h=5dadc95817479b4049c1f0d09947ec10b2b1e887;hb=HEAD#l30
      [3] https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/pthreadP.h;h=06fb0d74c5c5941dc6a96a44a938ad265838b049;hb=HEAD#l256
      [4] https://git.musl-libc.org/cgit/musl/tree/src/thread/pthread_getcpuclockid.c
      [5] https://www.openwall.com/lists/musl/2020/02/10/6

            alexsch Alexandr Scherbatiy
            alexsch Alexandr Scherbatiy
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: