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 concurrent access of node permissioning allow list #7920

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

pullurib
Copy link
Contributor

PR description

ArrayList() used for allowlist is not threadsafe. Adding/removing entries while iterating the list to check for an entry in isPermitted() will throw this exception. Added a testcase for this situation.

java.util.ConcurrentModificationException
	at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1687)
	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230)
	at java.base/java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.anyMatch(ReferencePipeline.java:632)
	at org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController.isPermitted(NodeLocalConfigPermissioningController.java:245)
	at org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController.isPermitted(NodeLocalConfigPermissioningController.java:238)
	at org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningControllerTest.lambda$whenCallingIsPermittedAndRemovingEntryInAnotherThreadShouldNotThrowException$0(NodeLocalConfigPermissioningControllerTest.java:335)
	at java.base/java.lang.Thread.run(Thread.java:1583)

....

OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
> Task :ethereum:permissioning:test
NodeLocalConfigPermissioningControllerTest > whenCallingIsPermittedAndRemovingEntryInAnotherThreadShouldNotThrowException() FAILED
    java.lang.AssertionError at NodeLocalConfigPermissioningControllerTest.java:367
1 test completed, 1 failed

Using CopyOnWriteArrayList is a simple fix considering it’s not a write heavy list

Fixed Issue(s)

#7916

@macfarla macfarla merged commit 0e908d2 into hyperledger:main Nov 25, 2024
43 checks passed
matthew1001 pushed a commit to kaleido-io/besu that referenced this pull request Nov 26, 2024
)

Signed-off-by: Bhanu Pulluri <[email protected]>
Co-authored-by: Bhanu Pulluri <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>
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