Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question

Problem adding and executing a new process type via GSHOME/config/gsa

I have a script, ConfigureSyslog.py, that I want to execute on each machine in a given lookup group, using the new GS-7.0 admin api. I'm trying to add a new process type per the GigaSpacesAgent documentation page, but I'm seeing an exception when GS tries to run the script...

My ConfigureSyslog.xml is as follows:

<process initial-instances="script">
  <script enable="true" work-dir="/opt/CSP/python" unix="/usr/bin/python /opt/CSP/python/ConfigureSyslog.py"/>

and it lives in /opt/GigaSpaces/config/gsa/ConfigureSyslog.xml

I'm trying to launch the script via GS with the following code:

AdminFactory factory = new AdminFactory() ;
Admin admin = factory.addGroup( "rds" ).createAdmin() ;

/* Testing executing a script/process via GSA. */
        GridServiceOptions options = new GridServiceOptions( "ConfigureSyslog" ) ;
        options = options.useScript() ;
        admin.getGridServiceAgents().waitForAtLeastOne() ;
admin.getGridServiceAgents().getAgents() 0 .startGridService( options ) ;

And I'm getting the following stack trace:

org.openspaces.admin.AdminException: Failed to start Grid Service
    at org.openspaces.admin.internal.gsa.DefaultGridServiceAgent.startGridService(DefaultGridServiceAgent.java:83)
    at com.co.grid.admin.model.GigaSpacesEventTest.testModel(GigaSpacesEventTest.java:27)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.io.IOException: Failed to start process based on xml configuration
    at com.gigaspaces.grid.gsa.GSAImpl.getProperties(GSAImpl.java:542)
    at com.gigaspaces.grid.gsa.GSAImpl.startProcess(GSAImpl.java:361)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.gigaspaces.lrmi.LRMIRuntime.invoked(LRMIRuntime.java:372)
    at com.gigaspaces.lrmi.nio.Pivot.consumeAndHandleRequest(Pivot.java:379)
    at com.gigaspaces.lrmi.nio.Pivot.handleRequest(Pivot.java:467)
    at com.gigaspaces.lrmi.nio.Pivot$ChannelEntryTask.run(Pivot.java:146)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
    at java.util.ArrayList.get(ArrayList.java:322)
    at com.gigaspaces.grid.gsa.GSAImpl.getProperties(GSAImpl.java:529)
... 15 more

This thread was imported from the previous forum.
For your reference, the original is available here

asked 2009-10-05 14:35:11 -0600

river2sea gravatar image

updated 2013-08-08 09:52:00 -0600

jaissefsfex gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

OK, adding the bogus <vm> element allowed my script to execute.

However, this script does not start a process, it is a one-shot execution. Now the problem I have is that the script runs, finishes, exits, and the GSA then runs it again, ad infinitum.

How can I tell the GSA that this script should simply run and exit?

Also is the schema of the GS/config/gsa/*.xml files documented anywhere?


answered 2009-10-06 12:22:40 -0600

river2sea gravatar image
edit flag offensive delete link more


The Grid Service Agent is documented here:

shay hassidim gravatar imageshay hassidim ( 2009-10-07 03:26:42 -0600 )edit

Thanks Shay, I've been reading that page for a while now. As for the XML definition for a process type, are there any elements/attributes that do not appear in the example on the GSA documentation page?

I'm still trying to figure out how to have my script execute and exit, without being restarted.

Thanks, Rowland

river2sea gravatar imageriver2sea ( 2009-10-07 10:06:03 -0600 )edit

Then you guys need to remove the following from the GSA documentation page:

"...Once spawned, the GSA assigns a unique id for it and manages its lifecycle. The GSA will restart the process if it exits abnormally (exit code different than 0), or if a specific console output has been encountered (for example, OutOfMemoryError)"

This implies that exiting a process with exit code = 0 will cause the GSA to NOT restart the process. I would state up front that this mechanism is for long-running processes only.

If I want the GSA to be my single point of management for a GS based system, what is the correct solution to executing scripts as commands at the OS level, as opposed to launching them as long-running processes?

Thanks, Rowland

river2sea gravatar imageriver2sea ( 2009-10-08 12:26:21 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2009-10-05 14:35:11 -0600

Seen: 217 times

Last updated: Oct 06 '09