JDK-8372445 : JFR files are generated in /tmp filling up space despite configured limitations
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17,21,25
  • Priority: P3
  • Status: New
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2025-11-25
  • Updated: 2025-11-25
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
Description
JFR files are being generated in /tmp and filling up disk space despite configured size limitations. It seems that setMaxSize() is being ignored, possibly because the system is overloaded.

On my system, running the test below produced JFR files of the following sizes(it grows slooowly):
 - 95,984,956 bytes
 - 260,490,687 bytes

This behavior indicates that the configured size limits are not being enforced consistently, which can lead to unexpected disk usage.

Steps to reproduce on JDK 17, 21 and 25:

    static {
        System.setProperty("java.io.tmpdir", "/tmp/serb");
    }

    public static void main(String[] args) throws InterruptedException {
        RecordingStream stream = new RecordingStream();
        stream.setMaxSize(150_000);
        stream.startAsync();
        Runtime.getRuntime().addShutdownHook(new Thread(stream::close));
        while (true) {
            Thread start = null;
            for (int i = 0; i < 100; i++) {
                // for 21+
                // Thread.Builder.OfVirtual ofVirtual = Thread.ofVirtual();
                // start = ofVirtual.start(() -> {});
            
                // for 17
                start = new Thread(() -> {});
                start.start();
            }
            start.join();
        }
    }
// the code is a bit unusual, I migrated it from a real reproducer/use case.