Withdrawn: JDK-8319307: DCmds should not assert on truncation and should report truncation

duke duke at openjdk.org
Wed Jan 24 05:44:39 UTC 2024


On Thu, 2 Nov 2023 12:04:16 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> `bufferedStream` was originally intended to provide intermediate output buffering; the buffer was supposed to drain upon flushing. However, in many cases, `flush()` is a no-op, so the buffer never gets drained.
> 
> To prevent infinitely raising buffer sizes for non-flushing `bufferedStream`, [JDK-8220394](https://bugs.openjdk.org/browse/JDK-8220394) introduced the notion of a "maximum reasonable cap". Upon reaching this threshold, we assert in debug VMs since we assumed this to be a condition worth analyzing. In release VMs, we silently truncate.
> 
> But DCmds - one of the primary users of `bufferedStream` - can reach the maximum cap under normal conditions; one example would be printing the list of dynamic libraries on Linux (just prints the process memory map) - this can get very large. Similarly, NMT detail reports and VM.info output can get just as large.
> 
> Therefore, neither asserting nor silent truncation is optimal. Instead, we should truncate the output, print a visible truncation marker, and - if possible - interrupt the printing.
> 
> ---
> 
> The patch is minimally invasive to simplify review. Like most stream classes, `bufferedStream` would benefit from an overhaul, but I'd like to leave that to a future RFE.
> 
> Testing: Tested manually with a number of commands with artificially increased output size. GHAs (Windows test errors unrelated).

This pull request has been closed without being integrated.

-------------

PR: https://git.openjdk.org/jdk/pull/16474


More information about the hotspot-runtime-dev mailing list