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

Fix teardown in SQLite File spec #8918

Merged
merged 8 commits into from
Feb 5, 2024
Merged

Conversation

Akirathan
Copy link
Member

@Akirathan Akirathan commented Jan 31, 2024

Pull Request Description

Fixes teardown of SQLite spec. There used to be only connection.close, but we also have to call connection.drop_table for every created table.

This causes problems only in [SQLite File] tests. These are backed by a sqlite file and some tables are persistent in that table. It is possible, that before tests are run, this file is non-empty and contains garbage from previous runs.

Important Notes

Should fix https://github.com/enso-org/enso/actions/runs/7724599547/job/21057063900#step:10:7243 that was triggered when Table_Tests were run on a non-clean runner.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@Akirathan Akirathan self-assigned this Jan 31, 2024
@Akirathan Akirathan added the CI: No changelog needed Do not require a changelog entry for this PR. label Jan 31, 2024
@radeusgd
Copy link
Member

This causes problems only in [SQLite File] tests. These are backed by a sqlite file and some tables are persistent in that table. It is possible, that before tests are run, this file is non-empty and contains garbage from previous runs.

While cleaning up seems the right thing to do, for this particular case it seems that a more robust solution would be to ensure that file.delete_if_exists is called before the first SQLite File test is run - that would ensure that even if a previous run did not clean something up (e.g. because it failed fatally with OOM or was terminated by a signal), the new run still gets a clean working environment. Cleaning afterwards is good and recommended, but ensuring the initial environemnt is clean seems even better.

Can we add a delete_if_exists to init?

@enso-bot enso-bot bot mentioned this pull request Jan 31, 2024
5 tasks
@Akirathan
Copy link
Member Author

Can we add a delete_if_exists to init?

@radeusgd Sure, good idea. Added in f4163b7

@Akirathan Akirathan added the CI: Ready to merge This PR is eligible for automatic merge label Feb 1, 2024
@Akirathan Akirathan added the CI: Keep up to date Automatically update this PR to the latest develop. label Feb 1, 2024
@Akirathan Akirathan removed the CI: Keep up to date Automatically update this PR to the latest develop. label Feb 1, 2024
@Akirathan
Copy link
Member Author

Akirathan commented Feb 1, 2024

Deleting the SQLite file before a connection is made is not a good idea. It causes failures like https://github.com/enso-org/enso/actions/runs/7741741366/job/21109332981?pr=8918#step:8:15352 for tests that create multiple connections. Let's revert f4163b7 and merge the PR. We will address other issues related to teardowns once some more transient failures occur.

GitHub
Hybrid visual and textual functional programming. Contribute to enso-org/enso development by creating an account on GitHub.

@radeusgd
Copy link
Member

radeusgd commented Feb 1, 2024

Deleting the SQLite file before a connection is made is not a good idea. It causes failures like enso-org/enso/actions/runs/7741741366/job/21109332981?pr=8918#step:8:15352 for tests that create multiple connections. Let's revert f4163b7 and merge the PR. We will address other issues related to teardowns once some more transient failures occur.

GitHub**Fix teardown in SQLite File spec · enso-org/enso@f5587b6**Hybrid visual and textual functional programming. Contribute to enso-org/enso development by creating an account on GitHub.

I still think it is a good idea, as argued before. It just has to be done at the proper place - it should be done once before all SQLite tests run, not on every connection being established.

@Akirathan Akirathan removed the CI: Ready to merge This PR is eligible for automatic merge label Feb 2, 2024
@Akirathan Akirathan added the p-high Should be completed in the next sprint label Feb 2, 2024
@mwu-tow mwu-tow merged commit 7bba021 into develop Feb 5, 2024
18 of 21 checks passed
@mwu-tow mwu-tow deleted the wip/akirathan/fix-db-table-leak branch February 5, 2024 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. p-high Should be completed in the next sprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants