[GE users] JGDI Memory leak ??

Sinong Fan fansn at hotmail.com
Thu May 8 09:55:20 BST 2008


Hi All
 
I'm asking for help about JGDI library. I'm using JGDI to monitor the jobs
in grid engine, however I find the programme eats more and more memory until
killed by the kernel at last. I checked java heap with no problem so I guess
there's some memory leak when calling JNI functions.
 
I wrote a very simple test programme and the memory usage grows from 17m -
200m overnight. Can anyone help? Many thanks!
 
package jgditest;
 
import java.io.*;
import java.util.*;
 
import com.sun.grid.jgdi.*;
import com.sun.grid.jgdi.monitoring.*;
import com.sun.grid.jgdi.configuration.Job;
 
/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class JGDITest
    implements com.sun.grid.jgdi.event.EventListener {
 
  protected JGDI jgdi;
 
  public JGDITest() {
 
    try {
 
      //initialize JGDI Client
      jgdi =
JGDIFactory.newInstance("bootstrap:///usr/local/extra/grid/n1ge@emea:6444");
      EventClient ec =
JGDIFactory.createEventClient("bootstrap:///usr/local/extra/grid/n1ge@emea:6
444", 0);
 
      ec.addEventListener(this);
      ec.subscribeAddJob(true);
      ec.start();
      ec.commit();
 
    }
    catch (JGDIException e) {
      e.printStackTrace();
    }
    catch (IOException e) {
      e.printStackTrace();
    }
    catch (InterruptedException ex) {
      ex.printStackTrace();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
 
 
 
  }
 
  //query the Grid Engine
  public void updateQueueView() {
 
    QueueInstanceSummaryOptions options = new QueueInstanceSummaryOptions();
    options.setShowFullOutput(true);
 
    if (jgdi != null) {
        try {
 
            QueueInstanceSummaryResult result =
jgdi.getQueueInstanceSummary(options);
 
            if (result != null) {
                List<QueueInstanceSummary> queueInstanceList =
result.getQueueInstanceSummary();
                List<JobSummary> jobPendingList = result.getPendingJobs();
 
                for (QueueInstanceSummary qis : queueInstanceList) {
                    List<JobSummary> jobRunningList = qis.getJobList();
                    for (JobSummary js : jobRunningList) {

                        System.out.println(js.getName());
                        System.out.println(new
Integer(js.getId()).toString());
                        System.out.println(js.getUser());
                        System.out.println(js.getStartTime());
                        System.out.println(js.getState());
                        System.out.println(js.getQueue());
                        System.out.println(new
Integer(js.getSlots()).toString());
 
                    }
                }
 
                for (JobSummary js : jobPendingList) {

                    System.out.println(js.getName());
                    System.out.println(new Integer(js.getId()).toString());
                    System.out.println(js.getUser());
                    System.out.println(js.getSubmitTime());
                    System.out.println(js.getState());
                    System.out.println(js.getQueue());
                    System.out.println(new
Integer(js.getSlots()).toString());
                }
 
            }
 
      }
      catch (Exception ex) {
        ex.printStackTrace();
      }
    }
 
  }
 
  public void eventOccured(com.sun.grid.jgdi.event.Event event) {
     updateQueueView();
  }
 
  public static void main(String[] argv) {
    new JGDITest();
  }
 
}
 
 
Yours sincerely,
 
 
Sinong Fan
 



More information about the gridengine-users mailing list