Skip to content

Reconciliation for one Reconciler is sometimes executed in parallel in two different threads #2326

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

Closed
ebma16 opened this issue Apr 2, 2024 · 2 comments · Fixed by #2328
Closed
Assignees

Comments

@ebma16
Copy link

ebma16 commented Apr 2, 2024

Hello,

I'm currently implementing some simple Integration Tests, using Kotlin and
jenvtest v0.9.7,
josdk v4.8.1

Even if I noticed following topics during the implementation of Integration Tests, I think it is more related to the Event Sources..
Unfortunately my project is no open source, so I will try to describe what I'm doing and provide some log messages.

  • My operator consists of 3 different reconcilers.
  • Every reconciler manages one CRD and listens to events of Custom Resources managed by the other Reconcilers via EventSources.
  • Additionally two reconcilers manage its own dependent resources (via a Managed Dependent Resources Workflow).

Before any Integration Test is executed, I want to start the operator and register every reconciler via:

    val operator = Operator { overrider: ConfigurationServiceOverrider -> overrider.withKubernetesClient(client) }
    operator.register(Reconciler1())
    operator.register(Reconciler2())
    operator.register(Reconciler3())

My observations:

  • What I sometimes notice is, that a reconciliation of the same reconciler is executed in parallel when starting the operator (see "Example 1" in attached file "eventSourcesExample").
  • I can see this behaviour also for Dependent Resources. Sometimes the reconciliation for a Dependent Resource is executed in parallel, afterwards it will be tried to create the Dependent Resource in parallel, and fabric8 throws an Exception, that the Dependent Resource is already existing (see "Example 2" in attached file "eventSourcesExample").

I've also attached the more detailed debug log (see attached file "DebugOutput").

My questions:

  • Is this something expected and has to be prevented by myself?
  • Is it possible that the reconciliation for a reconciler is executed in parallel in case it is triggered by a change of the own Custom Resource and by an Event from another Custom Resource?

Files:
eventSourcesExample.txt
DebugOutput.txt

@csviri I invited you to a repository, that has a similar structure like the production one and where you could reproduce the issue when executing the "OperatorIntegrationTest". Sometimes this behaviour happens more often, sometimes only once in 10 runs...

@csviri csviri self-assigned this Apr 2, 2024
@csviri
Copy link
Collaborator

csviri commented Apr 3, 2024

@ebma16
I've got:

* What went wrong:
A problem occurred configuring project ':operator:service'.
> Could not resolve all files for configuration ':operator:service:classpath'.
   > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.9.22.
     Required by:
         project :operator:service > org.jetbrains.kotlin.plugin.spring:org.jetbrains.kotlin.plugin.spring.gradle.plugin:1.9.22 > org.jetbrains.kotlin:kotlin-allopen:1.9.22
      > Unable to find a variant of org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.9.22 providing the requested capability org.jetbrains.kotlin:kotlin-gradle-plugin-api-gradle82:
           - Variant compile provides org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.9.22
           - Variant runtime provides org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.9.22
           - Variant sources provides org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.9.22
           - Variant javadoc provides org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.9.22
           - Variant platform-compile provides org.jetbrains.kotlin:kotlin-gradle-plugin-api-derived-platform:1.9.22
           - Variant platform-runtime provides org.jetbrains.kotlin:kotlin-gradle-plugin-api-derived-platform:1.9.22
           - Variant enforced-platform-compile provides org.jetbrains.kotlin:kotlin-gradle-plugin-api-derived-enforced-platform:1.9.22
           - Variant enforced-platform-runtime provides org.jetbrains.kotlin:kotlin-gradle-plugin-api-derived-enforced-platform:1.9.22

when running ./graldew build.

could you fix this pls.

@csviri csviri linked a pull request Apr 3, 2024 that will close this issue
@ebma16
Copy link
Author

ebma16 commented Apr 3, 2024

Hello @csviri,

I have updated some dependencies and the gradle wrapper (to v8.7).
At least for me a ./gradlew build or ./gradlew clean build works on Ubuntu 22.04 (via bash) and IntelliJ v2023.3.6 (Ubuntu and Windows)). If it still doesn't work for you, could you describe where/how you run the build?

I also created a local artefact from the linked branch with your concurrency changes and ran some tests. I have run a ./gradlew build about 15 times and the error has stopped occurring so far.

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 a pull request may close this issue.

2 participants