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

DefaultGCExchangeFacadeSessionProvider.openSession broken when called concurrently from multiple workflows #33

Closed
ahubold opened this issue May 19, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@ahubold
Copy link
Contributor

ahubold commented May 19, 2021

DefaultGCExchangeFacadeSessionProvider.openSession uses a java.lang.ServiceLoader to find GCExchangeFacadeProvider implementations. The ServiceLoader instance is used concurrently, if the method is called by multiple concurrently running workflow actions.

ServiceLoader however must not be used concurrently. From its Javadoc:

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

This can lead to NoSuchElementExceptions or not found implementations, which in turn lead to escalated workflows.

2021-05-19 08:03:12 - [WARN] com.coremedia.cap.workflow.plugin.LongActionBase [] - exception occurred in LongActionBase, will pass as result (LongActionManager-2 for coremedia:///cap/task/477873/477881)
java.util.NoSuchElementException: null
at java.base/java.lang.CompoundEnumeration.nextElement(Unknown Source)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(Unknown Source)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(Unknown Source)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(Unknown Source)
at java.base/java.util.ServiceLoader$2.hasNext(Unknown Source)
at java.base/java.util.ServiceLoader$3.hasNext(Unknown Source)
at com.coremedia.labs.translation.gcc.facade.DefaultGCExchangeFacadeSessionProvider.openSession(DefaultGCExchangeFacadeSessionProvider.java:40)
at com.coremedia.labs.translation.gcc.workflow.GlobalLinkAction.openSession(GlobalLinkAction.java:430)
at com.coremedia.labs.translation.gcc.workflow.GlobalLinkAction.doExecute(GlobalLinkAction.java:202)
at com.coremedia.labs.translation.gcc.workflow.GlobalLinkAction.doExecute(GlobalLinkAction.java:84)
...
2021-05-19 08:03:12 - [WARN] com.coremedia.labs.translation.gcc.workflow.GlobalLinkAction [] - com.coremedia.labs.translation.gcc.workflow.DownloadFromGlobalLinkAction: Unknown error occurred (GCC-WF-10000) (LongActionManager-3 for coremedia:///cap/task/494864/494872)
com.coremedia.labs.translation.gcc.facade.GCFacadeException: No GCExchange facade available as default/fallback.
at com.coremedia.labs.translation.gcc.facade.DefaultGCExchangeFacadeSessionProvider.openSession(DefaultGCExchangeFacadeSessionProvider.java:50)
at com.coremedia.labs.translation.gcc.workflow.GlobalLinkAction.openSession(GlobalLinkAction.java:430)
at com.coremedia.labs.translation.gcc.workflow.GlobalLinkAction.doExecute(GlobalLinkAction.java:202)
at com.coremedia.labs.translation.gcc.workflow.GlobalLinkAction.doExecute(GlobalLinkAction.java:84)
at com.coremedia.cap.workflow.plugin.LongActionBase.execute(LongActionBase.java:91)
@ahubold ahubold added the bug Something isn't working label May 19, 2021
aprantl added a commit that referenced this issue May 28, 2021
Fix #33 by loading services during construction into immutable list
aprantl added a commit that referenced this issue May 28, 2021
Fix #33 by loading services during construction into immutable list
aprantl pushed a commit that referenced this issue May 28, 2021
mtommila pushed a commit to mtommila/coremedia-globallink-connect-integration that referenced this issue Jun 9, 2021
…le list

replace iteration over ServiceLoader with iteration over preloaded list,
so that ServiceLoader isn't used concurrently anymore
mtommila pushed a commit to mtommila/coremedia-globallink-connect-integration that referenced this issue Jun 9, 2021
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

No branches or pull requests

1 participant