9 Replies Latest reply on Nov 8, 2017 12:57 PM by Bill Robinson

    blcli NSHScriptJob executeJobAndWait does not receive answer

      Hello,

       

      I've been using this blcli command for some time with no problems:

       

      blcli_execute NSHScriptJob executeJobAndWait "$JOB_KEY"

       

      but since a few days ago it does not work correctly.

       

      The blcli command launches the job and it finishes successfully but the blcli command does not receive answer and keeps waiting for it.

      Therefore, the script does not go on and my process remains waiting for the execution result...

       

      These is my script content:

       

          blcli_execute NSHScriptJob getDBKeyByGroupAndName "$JOB_FOLDER" "$JOB_NAME"

          if [ $? -ne 0 ]

          then

              echo " ">>${LogFile}

              echo "Error finding ${JOB_NAME}"

              echo "Error finding ${JOB_NAME}">>${LogFile}

              blcli_disconnect

              exit 1

          else

              blcli_storeenv JOB_KEY

          fi

       

          blcli_execute NSHScriptJob executeJobAndWait "$JOB_KEY"

          if [ $? -ne 0 ]

          then

                echo " ">>${LogFile}

                echo "Error launching ${JOB_NAME}">>${LogFile}

                blcli_disconnect

                exit 1

          else

              echo " ">>${LogFile}

              blcli_storeenv JOB_RUN_KEY

              echo "${JOB_NAME} launched SUCCESSFULLY">>${LogFile}

           

              #Error control

           

              blcli_execute JobRun getJobRunHadErrors "${JOB_RUN_KEY}"

              blcli_storeenv Error

          

              blcli_execute JobRun getJobRunHadWarnings "${JOB_RUN_KEY}"

              blcli_storeenv Warning

          fi

       

      Any idea of what is happening?

       

      Thank you very much.

        • 1. Re: blcli NSHScriptJob executeJobAndWait does not receive answer
          Bill Robinson

          what is the connectivity between where you run this script from and the appserver?

           

          are there any errors on the appserver between when the blcli command runs and the end of the job ?

          • 2. Re: blcli NSHScriptJob executeJobAndWait does not receive answer

            There is no error in blcli log:

             

            03 Dec 2014 09:39:47,209 DEBUG [MESSAGE] Looking for method com.bladelogic.om.infra.message.JobRequest.executeAndWait [/MESSAGE]

            03 Dec 2014 09:39:47,210 DEBUG [MESSAGE] Starting attempt #0 [/MESSAGE]

            03 Dec 2014 09:39:47,210 DEBUG [MESSAGE] New request, id = 11 [/MESSAGE]

            03 Dec 2014 09:39:47,210 DEBUG [MESSAGE] Sending request, id = 11 : executeAndWait():JobRequest.java:66 [/MESSAGE]

            03 Dec 2014 09:39:47,210 DEBUG [MESSAGE] Get connection from pool [/MESSAGE]

            03 Dec 2014 09:39:47,210 DEBUG [MESSAGE] Connection pool size : 1 [/MESSAGE]

            03 Dec 2014 09:39:47,210 DEBUG [MESSAGE] Used connetions : 1 [/MESSAGE]

            03 Dec 2014 09:39:47,210 DEBUG [MESSAGE] Got connection - com.bladelogic.om.infra.mfw.net.BlSessionClientConnection@23562c67 [/MESSAGE]

            03 Dec 2014 09:39:47,210 DEBUG [MESSAGE] Send on connection [/MESSAGE]

            03 Dec 2014 09:39:47,210 DEBUG [MESSAGE] registering client handler for cid = 10311 object = com.bladelogic.om.infra.message.JobRequest@79b2591c [/MESSAGE]

            03 Dec 2014 09:39:47,210 DEBUG [MESSAGE] Will send frame of size 73 [/MESSAGE]

            03 Dec 2014 09:39:47,211 DEBUG [MESSAGE] Data sent - 77 [/MESSAGE]

            03 Dec 2014 09:39:47,211 DEBUG [MESSAGE] Reading from connection [/MESSAGE]

             

            and there isn't any errors in the appserver log either.

             

            On the other hand, connectivity between appserver and the server where I run the script is also correct.

             

            Any other idea?

             

            Thank you very much.

            • 3. Re: blcli NSHScriptJob executeJobAndWait does not receive answer
              Bill Robinson

              what do you mean by 'connectivity is correct' ?

               

              can you attach the output of your script and the appserver logs from the same time ?

              • 4. Re: blcli NSHScriptJob executeJobAndWait does not receive answer
                Alexandre Dumont

                Hi Samantha & Bill Robinson

                 

                I seem to have the same problem here.

                 

                blcli_execute NSHScriptJob executeJobAndWait ...

                 

                Works fine if run in a NSH "alone".

                 

                If I call the same NSH as part of a Batch job run in "Execute per server" mode, none of these call actually ends (despite each individual NSH called by executeJobAndWait having finished).

                 

                Is it a known issue??

                • 5. Re: blcli NSHScriptJob executeJobAndWait does not receive answer
                  Bill Robinson

                  So you have a nsh script job that runs ‘executeJobAndWait’.  This kicks off some other job.

                   

                  The nsh job is a member job of a batch job.

                   

                  The batch job is set to run ‘by server’.

                   

                  “none of these call actually ends (despite each individual NSH called by executeJobAndWait having finished).” means what?  the executeJobAndWait line is done and you see the nsh script move on to the next line in the script?  the job that executeJobAndWait kicked off completed but the nsh job is still waiting at that line ?

                   

                  How long does the job run for ?

                   

                  Your appservers are of type ‘all’ ?  ‘job’ ?  do you have the ‘appserviceurl’ setting set for these in blasadmin ?  if so are they to a vip ?

                  • 6. Re: blcli NSHScriptJob executeJobAndWait does not receive answer
                    Todd Schaal

                    I'm having a similar issue.  Here is the code:

                     

                    # parameter list
                    # SERVICE_PROFILE_NAME = BL Service Profile Name for connecting
                    # USERNAME_USER=BladeLogic login username
                    # AUTH_TYPE=Authentication method used for login
                    # PASSWORD_USER=BladeLogic password for username
                    # APP_SERVER_HOST=BladeLogic App Server host
                    # ROLE_NAME=The role the username belongs to

                    SERVICE_PROFILE_NAME=DefaultProfile
                    USERNAME_USER=BLAdmin
                    AUTH_TYPE=SRP
                    PASSWORD_USER=xxxxxx
                    APP_SERVER_HOST=vmslcblasp01.regence.com
                    ROLE_NAME=BLAdmins

                    # set up connection
                    blcred cred -acquire -profile "$SERVICE_PROFILE_NAME" -username "$USERNAME_USER" -password "$PASSWORD_USER"
                    blcli_setoption serviceProfileName $SERVICE_PROFILE_NAME
                    blcli_setoption authType $AUTH_TYPE
                    blcli_setoption userName $USERNAME_USER
                    blcli_setoption password $PASSWORD_USER
                    blcli_setoption appserverHost $APP_SERVER_HOST
                    blcli_setoption roleName $ROLE_NAME
                    blcli_connect

                    JOB_KEY=$2
                    SERVER_NAME=$3
                    JOBTYPE=$4

                    #Clear old target servers from batch job
                    blcli_execute Job clearTargetServers $JOB_KEY
                    blcli_storeenv JOB_KEY

                    if [[  ${JOBTYPE} == "BatchJob" ]];then
                    blcli_execute BatchJob addNamedServerToJobByJobDBKey "$JOB_KEY" "$SERVER_NAME"
                    else
                    blcli_execute Job addTargetServer "$JOB_KEY" "$SERVER_NAME"
                    fi

                    blcli_storeenv JOB_KEY

                    #blcli_execute BatchJob executeJobAndWait $JOB_KEY
                    blcli_execute $JOBTYPE executeJobAndWait $JOB_KEY
                    blcli_destroy

                     

                     

                    It is executing a long-running batch job (it takes 30-45 minutest to complete).  The job finishes successfully,  but blcli_execute $JOBTYPE executeJobAndWait $JOB_KEY  never exits.  I have to kill nsh.exe manually.  Is there some time-out setting I need to adjust on my app server?

                    • 8. Re: blcli NSHScriptJob executeJobAndWait does not receive answer
                      Todd Schaal

                      Looks promising I will give it a try

                      • 9. Re: blcli NSHScriptJob executeJobAndWait does not receive answer
                        Bill Robinson

                        What’s probably happening is something is killing the connection between the blcli and appserver – it’s seen as idle since it’s …idle…. and there’s no keepalive for that connection.  there is a keeaplive for a nsh->rscd connection but this isn’t a nsh->rscd connection.