hcienginestop fails (where is kill)

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf hcienginestop fails (where is kill)

  • Creator
    Topic
  • #50517
    TorfinnK
    Participant

      Hello Clovertecher

      Cloverleaf 5.6 Rev.2 on Windows 2003

      Sometimes when I’m from the shell windows do a hcienginestop -p

      I get the following:

      hcicmd failed!

      Now trying SIGINT…

      Unable to send SIGINT: Invalid argument

      Now trying SIGKILL…

      Unable to send SIGTERM: Invalid argument

      If I look in the perl script hcienginestop.pl there is this section:

      Code:

         print “Now trying SIGINT…n”;
         if( kill( ‘INT’, $pid ) == 0 ) {
            print STDERR “Unable to send SIGINT: $!n”;
         }

      My question is: what/where is this kill command it tries to execute????

      Merry Christmas

      Torfinn

    Viewing 7 reply threads
    • Author
      Replies
      • #66433
        Robert Milfajt
        Participant

          This looks like the Perl kill function (syntax follows).  I guess the Perl signals are comparable to the standard UNIX ones from the UNIX kill command, SIGINT (UNIX) = INT (PERL), TERM (PERL) = SIGTERM (UNIX), etc.

          NAME

          kill – send a signal to a process or process group


          SYNOPSIS

          kill SIGNAL, LIST


          DESCRIPTION

          Sends a signal to a list of processes. Returns the number of processes successfully signaled (which is not necessarily the same as the number actually killed).

             $cnt = kill 1, $child1, $child2;

             kill 9, @goners;

          If SIGNAL is zero, no signal is sent to the process. This is a useful way to check that the process is alive and hasn’t changed its UID.

          Unlike in the shell, if SIGNAL is negative, it kills process groups instead of processes. That means you usually want to use positive not negative signals. You may also use a signal name in quotes.

          I am also inclusing a list of Kill Signals from signal.h.  Some kill signals do not terminate a process, and just signal it.  Thus the kill command is not aptly named.

          #define  SIGALRM   14

          #define  SIGCHLD   20

          #define  SIGCLD   20

          #define  SIGCONT   19

          #define  SIGEMT   7

          #define  SIGHUP   1

          #define  SIGIO   23

          #define  SIGKILL   9

          #define  SIGLOST   29

          #define  SIGPIPE   13

          #define  SIGPOLL   SIGIO

          #define  SIGPROF   27

          #define  SIGQUIT   3

          #define  SIGSEGV   11

          #define  SIGSTOP   17

          #define  SIGSYS   12

          #define  SIGTRAP   5

          #define  SIGTSTP   18

          #define  SIGTTIN   21

          #define  SIGTTOU   22

          #define  SIGURG   16

          #define  SIGUSR1   30

          #define  SIGUSR2   31

          #define  SIGVTALRM   26

          #define  SIGWINCH   28

          #define  SIGXCPU   24

          #define  SIGXFSZ   25

          Hope this helps,

          Robert Milfajt
          Northwestern Medicine
          Chicago, IL

        • #66434
          TorfinnK
          Participant

            Hi

            I did guess that the hcienginestop.pl tried to call a kill command, which is a nativ Unix command, but this is a Windows 2003 Server.

            When I searched for kill* I found a script called kill.al in the following folders:

            C:hciqdx5.6integratorexternalPerl_5.8.8srclibautoPOSIXkill.al

            C:hciqdx5.6integratorinstallperllibsautoPOSIXkill.al

            C:hciqdx5.6integratorlibperl5autoPOSIXkill.al

            This script looks like this:

            Code:

            # NOTE: Derived from ….libPOSIX.pm.
            # Changes made here will be lost when autosplit is run again.
            # See AutoSplit.pm.
            package POSIX;

            #line 211 “….libPOSIX.pm (autosplit into ….libautoPOSIXkill.al)”
            sub kill {
               usage “kill(pid, sig)” if @_ != 2;
               CORE::kill $_[1], $_[0];
            }

            # end of POSIX::kill
            1;

            To me this look’s much like some perl stuff.

            BUT the problem is, it doesn’t work. When hcienginestop.pl calls the kill command, it returns:

            Unable to send SIGINT: Invalid argument

            So the question is, why doesn’t hcienginestop.pl execute this kill command correct.

            Torfinn

          • #66435
            Robert Milfajt
            Participant

              No hablo Windows.

              Robert Milfajt
              Northwestern Medicine
              Chicago, IL

            • #66436

              Robert Milfajt wrote:

              No hablo Windows.

              word

              -- Max Drown (Infor)

            • #66437
              Rob Abbott
              Keymaster

                Torfinn this may be a bug on the Windows platform … please follow up with tech support.

                Rob Abbott
                Cloverleaf Emeritus

              • #66438
                frans de Wet
                Participant

                  This is a BUG on ALL platforms introduced since 5.7 when multiple processes separated by commas were allowed.  hcienginestop is broken.  Replace the stopProcess proc with this:

                  Code:


                  ######################################################################
                  # stopProcess – Stop the engine using progressively meaner tactics
                  #
                  sub stopProcess {
                     local( $pid );
                     local( @procs) = ();
                     local( $flag) = 0;
                     local( $proc_len);

                     $proc_len = @opt_proc;

                     foreach $p (@opt_proc) {

                  if ($proc_len > 1) {
                     print “Stopping process $p n”;
                  }

                  if( ($pid = &getHciEnginePid( $p )) == 0 ) {
                     print “Process ‘$p’ is not runningn”;
                     next;
                  }

                  # First try sending it a “die” command
                  print “Trying hcicmd…n”;
                  if ($onNT) {
                     if( system( “hcicmdnt.exe -p $p -c “. die”” ) ) {
                  printf STDERR “hcicmd failed!nn”;
                  push(@procs,$p);
                     }
                  } else {
                     if( system( “hcicmd -p $p -c “. die”” ) ) {
                  printf STDERR “hcicmd failed!nn”;
                  push(@procs,$p);
                     }
                  }
                     }

                     if (( $len = @procs ) != 0) {
                  @opt_proc = @procs;

                  # Give it time to die
                  $flag = &waitForAll();
                     } else {
                  $flag = 0;
                     }

                     #For flag, the true means there are some processes which are still  running
                     if ( $flag ) {
                  #There are some processes which are still running

                         # On Windows, try SIGKILL
                  if ( $onNT ) {
                     foreach $opt_p (@opt_proc) {
                  $PidFile = “$Pwdir/$opt_p/pid”;
                  print “Now trying SIGKILL…n”;
                  kill( ‘KILL’, $pid );
                  unlink( $PidFile ); # remove the pid file
                  print “Process ‘$opt_p’ is not runningn”;
                     }
                     return 1;
                  }

                  # On NUIX, try SIGINT first
                  foreach $opt_p (@opt_proc) {
                     # Now try SIGINT
                     print “Now trying SIGINT…n”;
                     if( kill( ‘INT’, $pid ) == 0 ) {
                  print STDERR “Unable to send SIGINT: $!n”;
                     }
                  }
                  if (&waitForAll()) {
                     #There are some processes which are still running
                     #Try SIGKILL then
                     foreach $opt_p (@opt_proc) {
                  # Now try SIGKILL
                  print “Now trying SIGKILL…n”;
                  if( kill( ‘KILL’, $pid ) == 0 ) {
                     print STDERR “Unable to send SIGKILL: $!n”;
                  }
                     }
                     
                     if (&waitForAll()) {
                  #There are some processes which can not be killed
                  foreach $opt_p (@opt_proc) {
                     print “nUnable to stop process ‘$opt_p’!n”;
                  }

                  return 0;
                     }
                  }
                     }

                     if ($proc_len > 1) {
                  #All processes are not running
                  print “All Processes are not runningn”;
                     }
                     return 1;
                  }

                • #66439
                  frans de Wet
                  Participant

                    Correction/clarification – on 5.7 (definitely on Linux) the addition of multiple process shutdown causes a problem where processes that are not able to shut down quickly are never SIGINT’d or SIGKILL’d.  the code above fixes that.

                  • #66440
                    Robert Gordon
                    Participant

                      In Windoze/Unix/Aix/Linux everything borders on permissions.  Systems admins can get a little too strict with system permissions, i.e. you can start a job, but can’t stop a job.  Tell them cloverleaf requires permissions to start and stop processes under the hci supperuser account.  Limiting functionality means the system Admins can now be included for cloverleaf alerts including the one’s that occur in the middle of the night.  Shortly some system admins will learn what 120 hours awake feels like.

                  Viewing 7 reply threads
                  • The forum ‘Cloverleaf’ is closed to new topics and replies.