JDK-8263696 : Print more info when windows os::create_thread fails
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2021-03-16
  • Updated: 2025-01-21
  • Resolved: 2025-01-21
Related Reports
Relates :  
Relates :  
Description
To help diagnosing os::create_thread failures, in the following block of code, all information should be printed at the "warning" level.

https://github.com/openjdk/jdk/blob/0d2f87e49401cc97ee095a836f4ca19741730b4f/src/hotspot/os/windows/os_windows.cpp#L771

    log_warning(os, thread)("Failed to start thread - _beginthreadex failed (%s) for attributes: %s.",
      os::errno_name(errno), describe_beginthreadex_attributes(buf, sizeof(buf), stack_size, initflag));
    // Log some OS information which might explain why creating the thread failed.
    log_info(os, thread)("Number of threads approx. running in the VM: %d", Threads::number_of_threads());
    LogStream st(Log(os, thread)::info());
    os::print_memory_info(&st);

Such failures are rare, and usually people won't be running with -Xlog:thread, so the messages aren't available when they are needed the most.
Comments
Runtime Triage: This is not on our current list of priorities. We will consider this feature if we receive additional customer requirements.
21-01-2025

IIRC this was discussed when this logging was put in. It is logging not error reporting as such. If this changes for Windows then it has to change for all platforms. Please see: http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2019-March/033045.html
16-03-2021