<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 13, 2023 at 5:03 PM Jan Kratochvil (Azul) <<a href="mailto:jkratochvil@azul.com">jkratochvil@azul.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Thomas,<br>
<br>
On Thu, 07 Dec 2023 00:22:34 +0800, Thomas Stüfe wrote:<br>
> are you sure this crash is related to JDK-8169373?<br>
<br>
No.<br>
<br>
<br>
> As far as I remember that bug resulted in threads possibly failing to start<br>
> because the thread stack size specified was too small;<br>
> I don't see how it can cause crashes like the one you describe. Once the<br>
> thread had been started successfully, things should work, no?<br>
<br>
The thread crashes still very early - in its glibc startup. As its TLS address<br>
(which is in the top last page of its stack) is unmapped. I expect another<br>
thread could accidentally unmap the pages due to some discrepancy of stack<br>
boundaries calculations between glibc and JVM. JVM was fixing some that stuff<br>
in:<br>
        JDK-8169373: Work around linux NPTL stack guard error<br>
<br>
hotspot/src/os/linux/vm/os_linux.cpp:<br>
bool os::pd_create_stack_guard_pages(char* addr, size_t size) {<br>
  if (os::is_primordial_thread()) {<br>
...<br>
    if (stack_extent < (uintptr_t)addr) {<br>
      ::munmap((void*)stack_extent, (uintptr_t)(addr - stack_extent));<br>
<br>
<br></blockquote><div><br></div><div>This coding only gets executed for the primordial thread, and the only way that could happen is if the hotspot had been embedded into a custom launcher. Is this the case here?</div><div><br></div><div>The normal java launcher invokes the JVM on a newly spawned pthread, so is_primordial_thread will always be false.<br></div><div> </div><div>..Thomas</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Thanks for hints,<br>
Jan<br>
</blockquote></div></div>