Job to dump the JobServer JVM properties and environment variables

Problem Description

Jobs executed in JobServer may generate different output than Jobs executed in Studio.

 

Root Cause

Different JVM properties and environment variables

 

Solution

Execute the Job_DumpJVMInfo.zip file attached to this article in Studio and JobServer. Compare the output of the Job.

 

To create the Job manually, follow the instructions below:

  1. Add a tJava component.

  2. In Advanced Settings of the tJava component, add the following lines:

    import java.util.Map;
    import java.util.Properties;
    import java.util.Enumeration;
    import java.lang.management.RuntimeMXBean;
    import java.lang.management.ManagementFactory;
    import java.lang.management.OperatingSystemMXBean;
  3. In Basic Settings of the tJava component, add the following lines:

    Date date = new Date();
    System.out.println(date);
    
    System.out.println("\n---------- Environment Variables");
    Map<String, String> env = System.getenv();
    for (String envName : env.keySet()) {
        System.out.format("%s=%s%n", envName, env.get(envName));
    }
    
    System.out.println("\n---------- JVM Properties");
    Properties props = System.getProperties();
    // props.list truncate at 40 charcaters ....
    // props.list(System.out);
    for (Enumeration k = props.keys() ; k.hasMoreElements() ;) {
       for (Enumeration e = props.elements() ; e.hasMoreElements() ;) {
          System.out.println(k.nextElement() + " = " + e.nextElement());
       }
    }
        
    System.out.println("\n---------- runtimeMXBean Properties");
    RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
    OperatingSystemMXBean operatingSystemMXBean =
        java.lang.management.ManagementFactory.getOperatingSystemMXBean();
    
     System.out.println(runtimeMXBean.getName());
     
     List<String> aList = runtimeMXBean.getInputArguments();
     String parameters = "";
     for (int i = 0; i < aList.size(); i++) {
         parameters = parameters + " " + aList.get(i);
         System.out.println (aList.get(i));
     }
        
    System.out.println("\n---------- runtimeMXBean Properties");    
      int cores = Runtime.getRuntime().availableProcessors();
      long freeMemory = Runtime.getRuntime().freeMemory();
      long totalMemory = Runtime.getRuntime().totalMemory();
      String osArch = operatingSystemMXBean.getArch();
      String osName = operatingSystemMXBean.getName();
      String osVersion = operatingSystemMXBean.getVersion();
      double loadAvg = operatingSystemMXBean.getSystemLoadAverage();
      
      System.out.println ("Number of cores : " + cores);
      // System.out.println ("Total Physical memory : " + operatingSystemMXBean.getTotalPhysicalMemorySize());
      System.out.println ("Free memory : " + freeMemory);
      System.out.println ("Total memory : " + totalMemory);
      System.out.println ("OS Arch : " + osArch);
      System.out.println ("OS Name : " + osName);
      System.out.println ("OS Version : " + osVersion);
      System.out.println ("Load Average : " + loadAvg);
      
    // Thread.sleep(1000);
    Date date2 = new Date();
    System.out.println("\n" + date2);
    
Version history
Revision #:
6 of 6
Last update:
‎04-13-2019 12:31 PM
Updated by: