From 4b348c9fec8d94846c6052add3037b11238fa0e1 Mon Sep 17 00:00:00 2001 From: Jeremy Manson Date: Wed, 29 Jul 2015 22:59:03 -0400 Subject: [PATCH 1/2] 6661889: thread id on Linux is inconsistent in error and log outputs Reviewed-by: dholmes, kvn --- hotspot/src/os/linux/vm/os_linux.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 0af27515e89..3b198380646 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -653,8 +653,7 @@ static void *java_start(Thread *thread) { OSThread* osthread = thread->osthread(); Monitor* sync = osthread->startThread_lock(); - // thread_id is kernel thread id (similar to Solaris LWP id) - osthread->set_thread_id(os::Linux::gettid()); + osthread->set_thread_id(os::current_thread_id()); if (UseNUMA) { int lgrp_id = os::numa_get_group_id(); @@ -1424,7 +1423,8 @@ size_t os::lasterror(char *buf, size_t len) { return n; } -intx os::current_thread_id() { return (intx)pthread_self(); } +// thread_id is kernel thread id (similar to Solaris LWP id) +intx os::current_thread_id() { return os::Linux::gettid(); } int os::current_process_id() { return ::getpid(); } From 98fb52479fdd94f158e455edcbc920ddc2490d3b Mon Sep 17 00:00:00 2001 From: Alexander Kulyakhtin Date: Thu, 30 Jul 2015 12:41:39 +0300 Subject: [PATCH 2/2] 8130527: Serviceability tests fails with Can't attach to process A helper method changed to provide workaround for 8132539 Reviewed-by: jbachorik --- hotspot/test/testlibrary/jdk/test/lib/Utils.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hotspot/test/testlibrary/jdk/test/lib/Utils.java b/hotspot/test/testlibrary/jdk/test/lib/Utils.java index 73027cbaab3..eb9ae00017c 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/Utils.java +++ b/hotspot/test/testlibrary/jdk/test/lib/Utils.java @@ -314,9 +314,8 @@ public final class Utils { */ public static String fileAsString(String filename) throws IOException { Path filePath = Paths.get(filename); - return Files.exists(filePath) - ? Files.lines(filePath).collect(Collectors.joining(NEW_LINE)) - : null; + if (!Files.exists(filePath)) return null; + return new String(Files.readAllBytes(filePath)); } /**