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

NamespacedHierarchicalStore should fail on modifications after close #3614

Closed
3 tasks done
leonard84 opened this issue Dec 19, 2023 · 4 comments
Closed
3 tasks done

Comments

@leonard84
Copy link
Collaborator

leonard84 commented Dec 19, 2023

Status Quo

The NamespacedHierarchicalStore doesn't track its state. Currently it is possible to call put() or any other modifying action after the store has already been closed via close(), allowing for potential misuse and bugs to creep in unknowingly.

Proposal

Any modification or query after close() should result in an IllegalStateException or similar. The method close() should be idempotent: any subsequent call to close() should effectively be a no-op.

Deliverables

  • NamespacedHierarchicalStore tracks its active/closed state
  • NamespacedHierarchicalStore throws an exception for modification or query calls after it has been closed
  • NamespacedHierarchicalStore.close() is idempotent
@sbrannen sbrannen changed the title NamespacedHierarchicalStore should fail on modifications after close NamespacedHierarchicalStore should fail on modifications after close Dec 19, 2023
@sbrannen sbrannen added this to the 5.11 M1 milestone Dec 19, 2023
@sbrannen
Copy link
Member

Thanks for raising the issue, @leonard84.

I've slated this for 5.11 M1.

Would you be interested in submitting a PR?

@marcphilipp marcphilipp modified the milestones: 5.11 M1, 5.12 Feb 2, 2024
mobounya added a commit to mobounya/junit5 that referenced this issue Mar 1, 2024
Track the active/closed state in NamespacedHierarchicalStore so it can
throw an IllegalStateException when doing a modification/query on it
after it has been already closed.

Make a close operation on an already closed store a no-op.

Issue: junit-team#3614
mobounya added a commit to mobounya/junit5 that referenced this issue Mar 1, 2024
Track the active/closed state in NamespacedHierarchicalStore so it can
throw an IllegalStateException when doing a modification/query on it
after it has been already closed.

Make a close operation on an already closed store a no-op.

Issue: junit-team#3614
@mobounya
Copy link
Contributor

mobounya commented Mar 1, 2024

Oops did not notice that this does not have an up-for-grabs label, can i still submit a PR for this ?

@marcphilipp
Copy link
Member

@mobounya Yes, feel free to do so! I've added the label now.

mobounya added a commit to mobounya/junit5 that referenced this issue Apr 28, 2024
Track the active/closed state in NamespacedHierarchicalStore so it can
throw an IllegalStateException when doing a modification/query on it
after it has been already closed.

Make a close operation on an already closed store a no-op.

Issue: junit-team#3614
@sbrannen sbrannen linked a pull request Apr 29, 2024 that will close this issue
9 tasks
mobounya added a commit to mobounya/junit5 that referenced this issue Apr 29, 2024
Track the active/closed state in NamespacedHierarchicalStore so it can
throw an IllegalStateException when doing a modification/query on it
after it has been already closed.

Make a close operation on an already closed store a no-op.

Issue: junit-team#3614
mobounya added a commit to mobounya/junit5 that referenced this issue Apr 30, 2024
Track the active/closed state in NamespacedHierarchicalStore so it can
throw an IllegalStateException when doing a modification/query on it
after it has been already closed.

Make a close operation on an already closed store a no-op.

Issue: junit-team#3614
sbrannen added a commit that referenced this issue May 1, 2024
@sbrannen
Copy link
Member

sbrannen commented May 6, 2024

The current implementation for tracking closed state does not mark the store as closed if an exception is thrown while invoking close actions or if there is no configured CloseAction.

See:

// TODO Reinstate assertion once we ensure the store is closed even if an exception is thrown.
// assertClosed();

I am therefore reopening this issue to address those two issues.

@sbrannen sbrannen self-assigned this May 6, 2024
@sbrannen sbrannen reopened this May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants