Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.exit makes GUI unable to initialize the project - don't exit the sandbox! #9872

Open
radeusgd opened this issue May 7, 2024 · 3 comments

Comments

@radeusgd
Copy link
Member

radeusgd commented May 7, 2024

This is partially expected, but I'm wondering if we should explicitly disallow usage of System.exit inside of GUI.

image

Because it shuts down the process, it kills the Language Server before it gets a chance to initialize.

The biggest problem is - the user can insert the System.exit node into a workflow, but afterwards it becomes impossible to remove it. Because to remove it the Language Server needs to initialize, but it shuts down before it has the chance to do so - breaking such a workflow completely, until it is manually edited in an external editor.

@radeusgd
Copy link
Member Author

radeusgd commented May 7, 2024

We definitely do not want to allow System.exit from breaking the Language Server.

Perhaps it should Panic if ran in interactive mode instead?

@farmaazon
Copy link
Contributor

farmaazon commented May 7, 2024

Shouldn't System.exit exit the current execution instead of the entire process in this case?

I imagine GUI just receiving "Execution failed" message with "exited with code X" or something along.

@radeusgd radeusgd changed the title Inserting System.exit in a workflow makes GUI enable to initialize the project Inserting System.exit in a workflow makes GUI unable to initialize the project May 9, 2024
@JaroslavTulach
Copy link
Member

JaroslavTulach commented May 14, 2024

Truffle offers a sandboxed way of doing exit. Instead of calling System.exit directly one should throw an exception with exit status. The exception shall be caught by language server and exit status shall be reported to the GUI, but the JVM shall not exit itself. Or:

As of 22.0 Truffle has support for polyglot context hard explicit exit triggered by guest languages using TruffleContext.closeExited(Node,int). It provides a unified way for languages to trigger the exit of the underlying polyglot context.

More on Truffle exit.

@JaroslavTulach JaroslavTulach changed the title Inserting System.exit in a workflow makes GUI unable to initialize the project System.exit makes GUI unable to initialize the project - don't exit the sandbox! May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📤 Backlog
Development

No branches or pull requests

4 participants