Spark log-out (Ticket SPARK-1215)

Hi,

I made some testing on Spark log-out/Spark log-out with reason menu actions and I noticed the following behavior:

1.Test on Windows XP - works with no problem for Spark installed from Spark 2.6.3 installer

2.Test on Windows 7 - works with no problem for Spark installed from Spark 2.6.3. installer

3.Test on Fedora Core 12 - unpacked Spark 2.6.3 tar.gz and started Spark by launching the start script - it does not work, it just exit spark without starting it again

4.Run spark using java command: java -jar startup.jar on all systems above and it fails for every case with following error in the console:

java.io.IOException: Cannot run program “/home/mirceac/.Spark/bin/spark”: java.io.IOException: error=2, No such file or directory

at java.lang.ProcessBuilder.start(ProcessBuilder.java:475)

at java.lang.Runtime.exec(Runtime.java:610)

at java.lang.Runtime.exec(Runtime.java:448)

at java.lang.Runtime.exec(Runtime.java:345)

These findings are very similar with SPARK-1215 ticket description

So I was thinking to make a different approach of this feature:

  1. use java -cp org.jivesoftware.launcher.Startup

a) the location of Startup.class is operating system independent retrieved using java.lang capabilities

b) the is operating system independent calculated given the location retrieved in a)

I am attaching a patch with this approach - that is tested on Windows XP, Windows 7, Fedora Core 12 and it has no importance how you start spark (using java -jar command or by running a start script, or by running an exe in windows)

It should work for MAC as well since there are the same commands working on MAC

Please have a look on the patch and let me know if worth changing the restart mechanism given above findings
SPARK-1215.patch.zip (1242 Bytes)

Well, i can’t test that as a version built from the sources starts with a cmd file and it will exit if i press log out. At least it does now. You will have to apply that patch to SVN so, i would be able to download nightly installer and test this.

commited: r12576

Thanks,

Mircea

What i have noticed is that now after you do a logout it doesn’t user starter.exe to start new Spark.exe instance, but it starts a java.exe and then it stays this way. It is not Spark.exe anymore, but java.exe in the processes list. Would be better to stay with Spark.exe process. Windows XP.

Thanks for looking into this - I will make required changes to use starter.exe once I will be back from vacation (next week)

As required in forum discussion (by wroot) - we should try using startup script

below commit provides a system independent way to search the startup script location based on java searching capabilities

r12584 = 7e9e4518973690436a650effb6539f8f452da039

-improved restart mechanism:

first search for startup script dinamically by asking java

where is the startup class. based on Startup.class location the startup script

location is retrieved. If the startup script is not found, use

java capabilities to start spark (automatically computing classpath

and use java -cp startupclass)

Ok. Now it uses starter.exe and starts Spark.exe after a logout, on Windows XP.

I have discoverd that, in getLibDirectory, the name of the file has to end with .jar or the result of the function will be null. Is this correct? The logout in our Spark installation (build with install4j) not working propper, if i add a condition for .exe files, everything will work. Can you test it this way?

First we try to restart application using starter.exe and spark.exe.

if (!restartApplicationWithScript()) {

restartApplicationWithJava();

}

If .exe is not found we are going to look for the location of Startup.class - which is in startup.jar and we try to restart using java command.

the getLibDirectory method will return null only if Startup.class is not located in a .jar file, but this always comes packaged in startup.jar

Please send me the error to have a look