Thread stack size issue related to glibc TLS bug

Jiangli Zhou jianglizhou at google.com
Thu May 23 23:21:18 UTC 2019


Hi David (and others),

There was a discussion [1] (between you, Jeremy, Martin and others)
back in 2015 regarding a stack size issue caused by a glibc bug
related to TLS (Thread local storage) [2]. The issue was manifested as
a StackOverflowError with the reported test in JDK-8130425 [0] when
large TLS size is used. A workaround was introduced with
-Djdk.lang.processReaperUseDefaultStackSize. Based on the glibc
discussion thread [2], Rust implemented a fix by taking into account
of the TLS size. From one of the comments in the OpenJDK discussion
archive [3], looks like you considered similar fix could be applied
for JVM. I talked to Jeremy about sharing his fix for this particular
issue today. The fix appears to be a more general solution than the
processReaperUseDefaultStackSize workaround. It has been tested/used
for server years and seems to be stable. The link to the changeset is
listed below. Please let me know your thoughts on taking the change in
OpenJDK.

[0] JDK bug: https://bugs.openjdk.java.net/browse/JDK-8130425
[1] OpenJDK discussion archive:
http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-December/037558.html
[2] glibc discussion archive:
http://sourceware.org/bugzilla/show_bug.cgi?id=11787
[3] change: http://cr.openjdk.java.net/~jiangli/tls_size/webrev/
(contributed by Jeremy Manson)

The #ifdef __GLIBC__ in the change could be removed as os_linux.cpp
already makes assumption about the use of glibc.

Best regards,
Jiangli


More information about the hotspot-runtime-dev mailing list