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: Improve thread safety issue #7338 #7366

Closed

Conversation

johnou
Copy link
Contributor

@johnou johnou commented Jan 30, 2025

Description of Change

Improve thread safety to avoid possible issues with timsort.

Related issues

Have test cases been added to cover the new functionality?

no

@boring-cyborg boring-cyborg bot added the core changes to core label Jan 30, 2025
@@ -196,7 +196,9 @@ public void setDescription(String description) {
* @return the value of references
*/
public Set<Reference> getReferences() {
return references;
synchronized (references) {
return Collections.unmodifiableSet(new HashSet<>(references));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

lmk if you think unmodifiableSet is too heavy handed, but I think modifying anything through the getter is an anti-pattern and out-right dangerous, especially when there are already add methods.

@johnou johnou changed the title Draft: Improve thread safety issue #7338 fix: Improve thread safety issue #7338 Jan 30, 2025
@johnou
Copy link
Contributor Author

johnou commented Jan 30, 2025

to avoid gc thrashing this approach makes more sense #7367

@johnou johnou closed this Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core changes to core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant