Opened 50 years ago

Last modified 9 years ago

#872 new task

IZ449: Remove hostname extention for pid files

Reported by: crei Owned by:
Priority: low Milestone:
Component: hedeby Version: 1.0
Severity: Keywords: bootstrap
Cc:

Description

[Imported from gridengine issuezilla http://gridengine.sunsource.net/issues/show_bug.cgi?id=449]

        Issue #:      449             Platform:     All         Reporter: crei (crei)
       Component:     hedeby             OS:        All
     Subcomponent:    bootstrap       Version:      1.0            CC:    None defined
        Status:       NEW             Priority:     P4
      Resolution:                    Issue type:    TASK
                                  Target milestone: 1.0u5next
      Assigned to:    adoerr (adoerr)
      QA Contact:     adoerr
          URL:
       * Summary:     Remove hostname extention for pid files
   Status whiteboard:
      Attachments:


     Issue 449 blocks:
   Votes for issue 449:     Vote for this issue


   Opened: Wed May 7 03:19:00 -0700 2008 
------------------------


   PathUtil.getPidFile generates Pid files by adding hostname to the file name. The
   pid files in the spool/run directory look as follows:

   JVM_NAME@HOSTNAME

   Task is to find out if this is still necessary and remove the hostname from the
   pid file if it is no longer used.

   If the hostname is removed in hedeby source, the testsuite must also be
   modified to reflect the new pidfile names correctly.
               ------- Additional comments from zwierzak Tue Aug 5 04:08:42 -0700 2008 -------
   still valid
               ------- Additional comments from afisch Thu Aug 14 02:31:21 -0700 2008 -------
   Description:
   For every started jvm a pid file is created in the run directory of the spool
   directory of the host machine. The file contains port and pid of the jvm and is
   named jvm@host. It is a general requirement that the spool directory is not
   allowed to be shared between different hosts. This implies that the host suffix
   is redundand as the pidfile will only be stored on this hosts spool dir.
   Therefore this host information can be removed.



   Evaluation:
   This issue is rated as P4 Task as it is only a cosmetic problem that does not
   affect the systems functionality/usability. A wontfix might be reasonable as
   this host name could be usefull to identify an accidentally shared spool
   directory. In this case there would be a mismatch of the machine name and die
   hostname in the pidfile.



   Analysis:
   The outcome of below analysis is:
   1) to change the naming of the pidfile a single position in the code has to be
   changed.
   2) there are no dependencies in the code that need the host prefix of the name
   as input
   3) the remains code is compatible to the previous naming scheme

   Details:
   The pid files are stored in the run directory. SDM ask for the run directory
   with the function:

       com.sun.grid.grm.bootstrap.PathUtil.getLocalSpoolRunPath()

   The alternative function getRunPath() in PathUtil is deprecated and not used in
   the project. This function is used to create the run directory and to get the
   PidFiles. These Pid files can be accessed via two methods. The first method is
   com.sun.grid.grm.bootstrap.PathUtil.getPidFile() which contains the following line:

       return new File(getLocalSpoolRunPath(env), jvmName + '@' +
   Hostname.getLocalHost().getHostname());

   that line should be changed to:

       return new File(getLocalSpoolRunPath(env), jvmName);

   The other method is: com.sun.grid.grm.bootstrap.PathUtil.getPidFiles(). This
   method does not have to be changed as it only lists existing files from the run
   directory. The usage of these two methods concern the below code lines:

   com.sun.grid.grm.bootstrap.JVMImpl:1143:
       File pidFile = PathUtil.getPidFile(getExecutionEnv(), getName());
       com.sun.grid.grm.bootstrap.JVMImpl:1144:
           File runDir = pidFile.getParentFile();    #the runDir used to check
   wether it exists!
       com.sun.grid.grm.bootstrap.JVMImpl:1149:
           shutdownHandler.deleteOnExit(pidFile);
       com.sun.grid.grm.bootstrap.JVMImpl:1154:
           FileWriter fw = new FileWriter(pidFile);
       com.sun.grid.grm.bootstrap.JVMImpl:1161:
           log.log(Level.FINE, "JVMImpl.pidFile", new Object[]{pid, port, pidFile});

   com.sun.grid.grm.bootstrap.ParentStartupService:146:
       File pidFile = PathUtil.getPidFile(env, jvm);
       com.sun.grid.grm.bootstrap.ParentStartupService:147:
           if (pidFile.exists() && (!forced || forced &&
   Platform.getPlatform().existsProcess(PathUtil.readPIDfromFile(pidFile)))) {
       com.sun.grid.grm.bootstrap.ParentStartupService:149:
           ret.put(jvm, new GrmException("ParentStartupService.skipRunningJvm",
   BUNDLE_NAME, jvmConfig.getName(), pidFile));
       com.sun.grid.grm.bootstrap.ParentStartupService:159:
           int r = fork(env, jvmConfig, systemEnv, debugPort, forced,
   pidFile.getAbsolutePath(), prefs);
       com.sun.grid.grm.bootstrap.ParentStartupService:366:
               patterns.put("@@@PID_FILE@@@", pidFile);
       com.sun.grid.grm.bootstrap.ParentStartupService:164:
           ret.put(jvm, new
   GrmException("ParentStartupService.failed_jvm_fork_pid_file_timeout",
   BUNDLE_NAME, jvmConfig.getName(),pidFile));

   com.sun.grid.grm.bootstrap.ParentStartupService:257:
       File pidFile = PathUtil.getPidFile(env, jvmConf.getName());
       com.sun.grid.grm.bootstrap.ParentStartupService:258:
           if (pidFile.exists()) {
       com.sun.grid.grm.bootstrap.ParentStartupService:259:
           if (!forced || (forced &&
   Platform.getPlatform().existsProcess(PathUtil.readPIDfromFile(pidFile)))) {
       com.sun.grid.grm.bootstrap.ParentStartupService:260:
           ret.put(jvmConf.getName(), new
   GrmException("ParentStartupService.skipRunningJvm", BUNDLE_NAME,
   jvmConf.getName(), pidFile));

   com.sun.grid.grm.bootstrap.ParentStartupService:284:
       File pidFile = PathUtil.getPidFile(env, jvmConf.getName());
       com.sun.grid.grm.bootstrap.ParentStartupService:285:
           int r = fork(env, jvmConf, systemEnv, BootstrapConstants.NO_DEBUG_PORT,
   forced, pidFile.getAbsolutePath(), prefs);
       com.sun.grid.grm.bootstrap.ParentStartupService:290:
           ret.put(jvmConf.getName(), new
   GrmException("ParentStartupService.failed_jvm_fork_pid_file_timeout", BUNDLE_NAME,

   com.sun.grid.grm.ui.component.StopJVMCommand:93:
       Iterator<File> iterator = PathUtil.getPidFiles(env).iterator();
       com.sun.grid.grm.ui.component.StopJVMCommand:96:
           String pidJVMName = pidFile.getName().split("@")[0];    #This line needs
   *NOT* be changed as it will still return the jvm and is backward compatible
       com.sun.grid.grm.ui.component.StopJVMCommand:100:
           jvmStopper = new JVMStopper(env,
           com.sun.grid.grm.ui.component.StopJVMCommand:198:
               jvmName = pidFile.getName().split("@")[0];    #This line needs *NOT*
   be changed as it will still return the jvm and is backward compatible
           com.sun.grid.grm.ui.component.StopJVMCommand:200:
               fr = new FileReader(pidFile);
           com.sun.grid.grm.ui.component.StopJVMCommand:210:
               throw new GrmException("ui.stopjvmcommand.pidreaderror", ex,
   BUNDLE_NAME, new Object[]{pidFile.getAbsoluteFile()});
           com.sun.grid.grm.ui.component.StopJVMCommand:212:
               throw new GrmException("ui.stopjvmcommand.pidnotfound", ex,
   BUNDLE_NAME, new Object[]{pidFile.getAbsoluteFile()});
           com.sun.grid.grm.ui.component.StopJVMCommand:214:
               throw new GrmException("ui.stopjvmcommand.pidreaderror", ex,
   BUNDLE_NAME, new Object[]{pidFile.getAbsoluteFile()});
           com.sun.grid.grm.ui.component.StopJVMCommand:221:
               log.log(Level.FINEST, "ui.stopjvmcommand.pidcloseerror",
   pidFile.getAbsoluteFile());

   None of these lines are affected when the naming shema is changed.

   The affect on the test suit is not analyzed here. Any problems that are related
   to the naming should immedeately arise when starting the testsuit after removing
   the host suffix. Thus it should be  easy to fix, too as the information of the
   hostname is redundand by checking the machines name.

   No new dependencies to the pidfile naming sheme should be introduced from now on
   to ensure the validity of this analysis.


   How to test:
   TS test to check that the expected set of pid files is there for a
   master/managed host install /start with the proper names, ports and pids. It
   should be tested that these files are removed properly after shut down.



   ETC:
   1 PD
               ------- Additional comments from afisch Thu Aug 14 02:58:29 -0700 2008 -------
   see Evaluation above
               ------- Additional comments from rhierlmeier Wed Nov 25 07:21:11 -0700 2009 -------
   Milestone changed

Change History (0)

Note: See TracTickets for help on using tickets.