Calling lscm.bat from a build script causes a hang
Spencer Murata (2.3k●11●59●71)
| asked May 24 '12, 3:16 p.m.
FORUM MODERATOR / JAZZ DEVELOPER edited Jun 04 '12, 9:37 a.m.
When calling lscm.bat from Hudson, Ant script, or other build tool is causing a hang where the build never terminates. However if I change the build tool to use scm.exe the hang disappears. Why does this happen?
|
Accepted answer
Caution should be used when using lscm.bat from a build script. The lscm.bat will start a daemon process if one is not already running on the system, and some build scripts will consider that daemon to be a child process. The build script will then wait for the daemon to terminate which will cause the build to hang up. The purpose of the lscm.bat is to load the scm tools only once and then reference it for future calls. If you are only calling a couple commands then it would be easier to just call scm.exe which does not create a daemon. However if you are going to use lots of scm commands you should start and stop the daemon process explicitly via scm daemon start and scm daemon stop respectively. That should keep the build scripts from waiting for the daemon to terminate.
When calling lscm.bat from Hudson, Ant script, or other build tool is causing a hang where the build never terminates. However if I change the build tool to use scm.exe the hang disappears. Why does this happen? Spencer Murata selected this answer as the correct answer
Comments
Bonnie Teymouri
commented Jan 17 '13, 2:48 p.m.
Even after I issue scm daemon start /share/root and background the process, subsequent lscm requests start another daemon, which I cannot control (running on Linux).
Two instances that this could happen...
Daniel martin
commented Mar 25 '14, 11:52 a.m.
Spencer,
I am writing some java code to get snapshot name during our builds in BF. The scm command works fine on our Linux boxes, but on windows it hangs.. forever. I have tried scm, lscm, starting a daemon manually. Nothing seems to work, what else can I try to allow the command to run inside a jar successfully on windows?
Is that using the SCM binary to run the command or the API?
Daniel martin
commented Apr 07 '14, 3:39 p.m.
We are using the scm binary, the API wasn't as straight forward. Here is a code snippet:
String command = "\"" + commandPath + File.separator + "lscm.bat"+"\""+" list snapshots -r " + repoAddress
+ " -u " + user + " -P " + "Password" + " -j " + workspaceUUID;
System.out.println("Using the following command:" + command);
Process proc = rt.exec(command);
BufferedReader br = new BufferedReader(isr);.
Do I need to include the start/stop daemon in the call>?
It would be safer to start and stop it in the script, but if you don't mind the daemon hanging around after the script runs and whatever build tool you are using to execute doesn't consider the daemon to be part of the build, i.e. it will allow the script to be marked complete, then you run without the start/stop calls. ~Spencer
showing 5 of 6
show 1 more comments
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.