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 does not give a chance for background threads to complete, affecting audit logs #9871

Open
radeusgd opened this issue May 7, 2024 · 0 comments
Labels
l-cloud-integration Enso Cloud integration work triage

Comments

@radeusgd
Copy link
Member

radeusgd commented May 7, 2024

This is probably partly by original design, but it has some unwanted consequences.

Because the audit logs are sent on a background thread, if the application exits by System.exit, some logs may be lost because the thread is killed without a chance to finish sending them.

Fortunately, our main use case - the interactive IDE - does not rely on using System.exit so we should be fine there. Still, batch Enso scripts, like the Test suite, may use it and ideally the logs should not be used there.

What can we do about it?

  1. Shall we disallow the System.exit command in the interactive mode altogether?
    i. Created a separate ticket about it as that has its own problems: System.exit makes GUI unable to initialize the project - don't exit the sandbox! #9872
  2. Shall we allow all threads to finish before ExitSystemNode calls to the Java System.exit?
    i. Or maybe should we allow to create 'protected' threads that are registered somewhere and are allowed to finish before the exit?
@radeusgd radeusgd added the triage label May 7, 2024
@radeusgd radeusgd added the l-cloud-integration Enso Cloud integration work label May 7, 2024
mergify bot pushed a commit that referenced this issue May 11, 2024
- Closes #9599
- Implemented API for sending audit logs to the cloud on a background thread.
- If the Postgres connection is opened through a datalink, its internal JDBC connection is replaced by a wrapper that reports executed queries to the audit log.
- Also introduces `EnsoMeta` - a helper Java class that can be used in our helper libraries to access Enso types.
- I have replaced the common pattern scattered throughout the codebase with calls to this 'library' to avoid repetitive code.
- Refactored `Table.display` to share code between in-memory and DB - it was needed as the function stopped working for `DB_Table` after adding making the `Table` constructor `private`.
- Clearer error when reading a SQLite database from a remote file (tells the user to download it first).
- Follow up - correlate asset id of the data link:
#9869
- Follow up - include project name (once bug is fixed):
#9875
- Some problems/improvements of the audit log:
- The audit log system is not yet ready for high throughput of logs
#9870
- The logs may be lost if `System.exit` is used
#9871
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
l-cloud-integration Enso Cloud integration work triage
Projects
Status: New
Development

No branches or pull requests

1 participant