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 JsonRPc Double dispose #6901

Merged
merged 4 commits into from
Apr 8, 2024

Conversation

obasekiosa
Copy link
Contributor

@obasekiosa obasekiosa commented Apr 5, 2024

Changes

  • Removes unnecessary arraypoollist dispose

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Documentation

Requires documentation update

  • Yes
  • No

If yes, link the PR to the docs update or the issue with the details labeled docs. Remove if not applicable.

Requires explanation in Release Notes

  • Yes
  • No

If yes, fill in the details here. Remove if not applicable.

Remarks

maybe Add a property on ArrayPoolList call isDiposed to check if object has been disposed.
useful for nested arrayPoolLists.

Since we usually want to dispose the entire collection from the top
and sometimes we dispose inner collection from somewhere else when they are passed as references.

Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dispose should be able to be called multiple times.
This looks like a proper place to dispose it in JSON RPC stack - after serialization. Where is the 2nd conflicting dispose happen?

Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok its disposed just above, so its fine, but added also safe dispose recursive

@obasekiosa
Copy link
Contributor Author

obasekiosa commented Apr 8, 2024

Dispose should be able to be called multiple times. This looks like a proper place to dispose it in JSON RPC stack - after serialisation. Where is the 2nd conflicting dispose happen?

True!
Calling dispose multiple times should in theory work.

the problem comes when attempting to access an arraypoollist that has been disposed.

Theres a guard that throws an error. For example accessing Count for the purpose of looping through a list to dispose its content.

@LukaszRozmej LukaszRozmej merged commit 45f80a1 into master Apr 8, 2024
67 checks passed
@LukaszRozmej LukaszRozmej deleted the fix/array-pool-list-double-dispose-crash branch April 8, 2024 11:59
kamilchodola pushed a commit that referenced this pull request Apr 9, 2024
Co-authored-by: lukasz.rozmej <lukasz.rozmej@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants