vdm-vscode icon indicating copy to clipboard operation
vdm-vscode copied to clipboard

Closing the GUI window spawned from VDM will crash the server

Open jonaskrask opened this issue 3 years ago • 7 comments

Happened in the project https://github.com/jonaskrask/vdm-vscode/tree/development/resources/examples/VDMSL/ConwayGameLifeSL

When I run using the last launch configuration ("Launch ConwayGameLifeSL Debug 4") the server crash if you close the window that is opened, even if you wait till the debug session is over.

jonaskrask avatar Feb 14 '22 12:02 jonaskrask

Related to #76

jonaskrask avatar Feb 14 '22 12:02 jonaskrask

Looks like this one has inherited a different Java class to the one I know - this model was tinkered with by the Overture folk.

The situation with VSCode is that the native "GUI" runs in the same process as the LSP Server, so if you kill it, perhaps by setting an "exit on close" flag for the GUI, then that kills the server. The version of the class I have cleans itself up when you close the GUI and disposes of its resources, but doesn't exit the process.

If I send updated Java source and jar, can you try those?

Conway.rename-to-jar.txt

nickbattle avatar Feb 14 '22 12:02 nickbattle

I already added that jar to illustrate "remote control" (located in lib/gui_remote.jar). If I only use your jar the following functions in Graphics.vdmsl will not work (meaning the Debug 4 launch configuration does not work).

    initialise: nat1 * nat1 -> int
    initialise(gridSideCount, sleepTime)== is not yet specified;
    
    newLivingCell: int * int -> int
    newLivingCell(x,y)== is not yet specified;
    
    newRound: () -> int
    newRound()== is not yet specified;

Should we just remove that code and the launch configuration and stick to the remote control? Or do you have a better idea?

jonaskrask avatar Feb 14 '22 13:02 jonaskrask

Yes, if their "improved" Conway example isn't really adding anything over the one we're using for remote control, perhaps it's easiest to drop the example that fails.

nickbattle avatar Feb 14 '22 13:02 nickbattle

Apart from the GUI being launched from the spec and not the other way around I don't think it adds anything, but not sure.

@idhugoid do you know if there is an important difference between the two Conway versions?

jonaskrask avatar Feb 14 '22 14:02 jonaskrask

This is probably the wrong approach, but how hard would it be for the Client to check when a launch has a "remoteControl", and if so, check whether the Server has stopped afterwards? It could then restart it, on the basis that the user code must be at fault - perhaps with an ugly notification, saying "Your remote control class terminated abnormally".

nickbattle avatar Feb 14 '22 20:02 nickbattle

Hmm.. I will see if something like this is doable

jonaskrask avatar Feb 15 '22 13:02 jonaskrask