Thank you very much for the pointer Sharon. I created a loop where I query
the handle of the process to check if the process is complete and in that
loop I also check if a reboot is being requested. If there is a reboot
request I shutdown STAFProc on the remote machine, wait for reboot to
complete before proceeding with the remaining test execution.
Thanks
Anna
On Tue, Oct 12, 2010 at 7:38 AM, Sharon Lucas <luc...@us.ibm.com> wrote:
> You're seeing this problem because the machine being rebooted never sends a
> message that the process completed (e.g. was terminated) because STAFProc
> is not being shutdown properly (e.g. via a STAF local SHUTDOWN SHUTDOWN
> request) before the reboot occurred. If your script could be changed to
> shutdown STAFProc properly before being rebooted, then the hang wouldn't
> occur because the PROCESS START WAIT request would fail with RC 22 (and the
> result would contain an error message like "STAFConnectionReadUInt: Error
> reading from socket: other side closed).
>
> We have a bug open for this, Bug #2978990 "PROCESS START WAIT request hangs
> if reboot target machine" at
>
> http://sourceforge.net/tracker/?func=detail&aid=2978990&group_id=33142&atid=407381
> .
> We should change STAF to perhaps do handle garbage collection so that the
> PROCESS service registers for notification when the process handle no
> longer exists or if that instance of STAFProc is no longer running on the
> target machine so that the PROCESS START WAIT request would fail with RC 22
> even when STAFProc is not properly shutdown.
>
> So, the best workaround until that bug is fixed would be if your script
> could be changed to submit a SHUTDOWN request to the SHUTDOWN service on
> the local machine before submitting a command to reboot the machine.
>
> If for some reason you can't do that,, another. less elegant, workaround
> would be to submit the PROCESS START request without the WAIT option, but
> with the NOTIFY ONEND request. The PROCESS START request without the WAIT
> option will return the handle of the process immediately (not waiting for
> the process to complete). When/if the process completes, the STAF handle
> that submitted the PROCESS START request will be sent a STAF/Process/End
> notification message via the QUEUE service. You could then have a loop
> that sleeps for a while and then checks if the process is still running,
> e.g. STAF machine PROCESS QUERY HANDLE <ProcessHandle#> and continue
> looping only if the process is still running as indicated by the request
> completing successfully and the "Return Code" in the result is not set yet.
> If the "Return Code" in the result is set, then the process has completed
> and you can check the queue of the handle that submitted the PROCESS START
> request (e.g. STAF local QUEUE GET TYPE STAF/Process/End) to get the
> process completion message for the machine's process handle. If the
> PROCESS QUERY HANDLE request fails, then the process is no longer running.
>
> --------------------------------------------------------------
> Sharon Lucas
> IBM Austin, luc...@us.ibm.com
> (512) 286-7313 or Tieline 363-7313
>
>
>
>
> From: Anna Pereira <annazpere...@gmail.com>
> To: staf-users@lists.sourceforge.net
> Date: 10/11/2010 04:31 PM
> Subject: [staf-users] staf command hangs on reboot
>
>
>
> Hi,
>
> I need to run a command like "staf x.x.x.x process start shell command
> "scriptA" wait returnstdout stderrtostdout" followed by a bunch of
> other commands on my test machine from the server. The problem is,
> scriptA sometimes causes the test machine to reboot. There is no way
> to determine in advance if scriptA will causes the test machine to
> reboot or not. Secondly, there is no way to figure out how long
> scriptA will run hence I cannot specify the wait period to be for a
> certain duration before timing out. The test machine has STAFProc
> configured to start on reboot. The problem is, if scriptA causes the
> test machine to reboot, the above staf command hangs and the rest of
> the staf commands do not get executed. Is there a way I can specify
> that if the test machine reboots, the staf command should terminate,
> sleep till the test machine is up again and then execute the rest of
> the commands or is there some other way of doing this?
>
> Thanks
> Anna
>
>
> ------------------------------------------------------------------------------
>
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
> Spend less time writing and rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> staf-users mailing list
> staf-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/staf-users
>
>
>
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users