Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8345117

Linux ProcessHandle.Info commandLine truncated to 4096 characters

    • x86_64
    • linux

      ADDITIONAL SYSTEM INFORMATION :
      Linux 6.8

      A DESCRIPTION OF THE PROBLEM :
      When the starting command line is over 4096 characters, commandLine() response is truncated to 4096 characters and arguments() returns empty result. Since Linux 4.2 /proc/<pid>/cmdline is not truncated anymore, so it should be possible to fetch the full command line on any modern system.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Use the following code and start the program with any long enough arguments:

      ProcessHandle.Info info = ProcessHandle.current().info();
      System.err.println(info.commandLine());
      System.err.println(info.commandLine().orElseThrow().length());
      System.err.println(info.arguments().map(Arrays::toString));


      FREQUENCY : always


            rriggs Roger Riggs
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: