-
Notifications
You must be signed in to change notification settings - Fork 10
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
Shutdown ScheduledExecutorService at runtime termination #272
Comments
Thanks for your contribution 🔥 We will take a look asap 🚀 |
please provide a proper, self-contained reproduction guide that doesn't involve other repositories, preferably in the form of a test, e.g. as Gist. Do you mean that a thread keeps running after the host runtime (= java process) is killed? |
Sure. I will work on that.
By runtime I mean the EDC BaseRuntime. The thread keeps running after the BaseRuntime shutdown has been processed. |
I have provided a test class FcRecurringExecutionPlanTest.java which contains the tests designed to reproduce the bug. The updated "Steps to Reproduce" section includes detailed guidelines to replicate the issue. |
I copied the code, and ran it, but unfortunately it does not illustrate the claimed defective behaviour at all - both were green. All you did was more or less copy another e2e test and duplicate it in a nested test suite. Unless you can provide a test setup to clearly show the defective behaviour in a test with assertions, I'm afraid I'll have to close this issue. Here, what you will have to prove is that exiting the process doesn't actually kill all its threads. In Java, all Threads that belong to a certain process (i.e. the java programm) are killed when the process exists. Shutting down the runtime is exactly that, terminating the process. I would also recommend reading up on the use of the |
Both of the tests will pass. The behavior is that even after the responsible BaseRuntime gets terminated, the task keeps running. And this can be tracked in the logs.
The issue occurs when multiple runtimes are booted. To demonstrate this behavior, I used that test example as a baseline.
The issue is that tasks continue to run even after their runtimes have ended. While this does not cause the tests to fail, it can be observed in the logs. Although it doesn't impact the current tests, it leads to resource shortages in the GitHub pipeline, affecting other tests. |
yeah, but what you created isn't a test. A (JUnit) test consists of three parts: arrange (set up test data), act (make the system under test do something), assert (verify a certain outcome). You created another, very complicated way to start a runtime, that uses the JUnit framework in the wrong way. In any event. I think what you actually mean is this: The executor service in the If that is the case, then this is more of a feature request, rather than a bug, because all threads die when the owning process dies, so it is not faulty behaviour. Terminating the java process (= runtime) will definitely stop all the threads (= executor service). As such, I would propose to close this issue, and start with a discussion first. |
Yes, that's precisely what I intended to say in the issue.
We can proceed as you’ve suggested. Should I open a discussion for the feature request?
I was thinking of the solution more in this direction. This way, execution plans using the executor services for recurring tasks can override the
For |
Yes please open a discussion for a feature request |
I have created a discussion here: #273 |
Bug Report
The
ScheduledExecutorService
(responsible for recursive crawling) does not shutdown when the EDC BaseRuntime gets shutdown.Describe the Bug
In the current implementation of FederatedCatalog, the
ExecutionPlan
creates aScheduledExecutorService
that repetitively executes the crawling task. However, during runtime shutdown, theExecutorService
is not terminated as expected, causing the tasks to keep running indefinitely.Expected Behavior
The
ScheduledExecutorService
should terminate gracefully during runtime shutdown. This includes canceling all future tasks, ensuring a proper shutdown, and cleaning up resources.Observed Behavior
The
ExecutorService
does not terminate and continues executing tasks after the runtime shutdown is processed.Steps to Reproduce
FcRecurringExecutionPlanTest.java contains tests designed to reproduce the issue.
Steps to reproduce the bug:
FederatedCatalog
../gradlew test -DincludeTags="EndToEndTest" -PverboseTest=true
Logs Review
Track the logs of,
Task :system-tests:end2end-test:e2e-junit-runner:test
, starting from the following log,In this test class we have two catalogs:
catalog-one
andcatalog-two
. Let's say, catalog-one starts execution first. So it goes through the following phases:catalog-one
runtime bootStarts crawling. This can be observed in the logs through entries similar to the following,
Shutdown
catalog-one
runtimeIn ideal case, the
catalog-one
crawler thread should get terminated after the shutdown. However, even after the runtime gets terminated, the scheduled thread keeps running. And so we can observe the following logs through out rest of the execution (through out the execution ofcatalog-two
test).Context Information
Detailed Description
If applicable, add screenshots and logs to help explain your problem.
Possible Implementation
Proper shutdown method in
FederatedCatalogCacheExtension
to trigger the shutdown of theExecutorService
should solve this issue. This will ensure that all the scheduled tasks are terminated properly at the time of runtime shutdown.The text was updated successfully, but these errors were encountered: