JDK-8263696 : Print more info when windows os::create_thread fails
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2021-03-16
  • Updated: 2022-06-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
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
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