mattcasters opened a new pull request, #9257: URL: https://github.com/apache/hop/pull/9257
## What Fixes #8604. Stopping a workflow that is reading from Kafka left the Pipeline action painted as running, and the Kafka Consumer transform stayed in **Halting** forever. Halting means the transform thread is still marked running after it has been asked to stop. `markStop()` is what clears that flag, and it runs only after `dispose()` returns. Kafka 3.9 keeps a `wakeup()` flag until the next `poll()`. `close()` polls while it leaves the consumer group, so a wakeup armed for Stop made `close()` throw. `dispose()` did not catch that, the thread died, and the status never left Halting. The pipeline never finished, so the workflow action never left `activeActions`. The toolbar treated the workflow as idle as soon as the stopped flag was set, which disabled Stop and froze the canvas on the running icon. ## Changes - `KafkaConsumerInput.stopRunning()` only calls `wakeup()` (the one thread-safe Kafka call) and stops the sub-pipeline, so a batch that is inside `oneIteration()` can cancel. It tolerates a consumer that does not exist yet. - `dispose()` closes with a 10 second timeout and does not call `wakeup()` or `unsubscribe()`. A pending wakeup is drained with `poll(Duration.ZERO)` first. A failed close is logged and does not escape. - A batch duration of 0 polls for about one second instead of forever, so Stop is noticed while the topic is idle even when `wakeup()` does not land. - `RunThread` still calls `markStop()` when `dispose()` throws, so a dead thread becomes Stopped instead of Halting. - The first Stop is unchanged. While the workflow or pipeline is still Halting, Stop stays enabled. A second click calls `forceStop()`, which interrupts transform threads that did not leave their blocking call. `stopAll()` stays one-shot. - The workflow canvas keeps redrawing until the action has actually returned. ## Testing - [x] `./mvnw -pl engine,plugins/transforms/kafka,plugins/actions/pipeline,ui -am test -Dtest=RunThreadTest,KafkaConsumerInputTest,PipelineForceStopTest,WorkflowForceStopTest -Dsurefire.failIfNoSpecifiedTests=false` - [x] Checkstyle clean on `engine`, `ui`, `plugins/actions/pipeline`, and `plugins/transforms/kafka` - [ ] Full `mvn clean install apache-rat:check` was not run - [ ] The SWT toolbar and canvas were not exercised in a running Hop GUI ------------------------ Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] Run `mvn clean install apache-rat:check` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [x] If you have a group of commits related to the same change, please squash your commits into one and force push your branch using `git rebase -i`. - [x] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. To make clear that you license your contribution under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0) you have to acknowledge this by using the following check-box. - [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0) - [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
