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

Cannot invoke "java.lang.ClassLoader.getParent()" because "this.currentLoader" is null #643

Closed
flebastard opened this issue Jun 24, 2024 · 0 comments · Fixed by #650
Closed
Labels
bug Something isn't working

Comments

@flebastard
Copy link

Hi,
Since cloudevents-core:3.0.0, we are experiencing this error

java.lang.NullPointerException: Cannot invoke "java.lang.ClassLoader.getParent()" because "this.currentLoader" is null
	at java.base/java.util.ServiceLoader$ModuleServicesLookupIterator.hasNext(ServiceLoader.java:1075)
	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
	at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
	at io.cloudevents.core.provider.CloudEventValidatorProvider.validate(CloudEventValidatorProvider.java:48)
	at io.cloudevents.core.v1.CloudEventBuilder.build(CloudEventBuilder.java:127)

This does not happen every time we use the builder. I suspect a race condition as CloudEventValidatorProvider is a Singleton that relies on the ServiceLoader class which is not thread safe according to its documentation.

Instances of this class are not safe for use by multiple concurrent threads.

@pierDipi pierDipi added the bug Something isn't working label Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants