Skip to content

Issue #8604 : Stop the Kafka Consumer from staying in Halting - #9257

Draft
mattcasters wants to merge 2 commits into
apache:mainfrom
mattcasters:issue-8604
Draft

mattcasters wants to merge 2 commits into
apache:mainfrom
mattcasters:issue-8604

Conversation

@mattcasters

Copy link
Copy Markdown
Contributor

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

  • ./mvnw -pl engine,plugins/transforms/kafka,plugins/actions/pipeline,ui -am test -Dtest=RunThreadTest,KafkaConsumerInputTest,PipelineForceStopTest,WorkflowForceStopTest -Dsurefire.failIfNoSpecifiedTests=false
  • 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.
  • 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.
  • 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
you have to acknowledge this by using the following check-box.

A pending wakeup made Kafka close() throw, so the transform thread
died before markStop() and the status stayed Halting. Close without
a new wakeup, stop the sub-pipeline, and keep a second Stop available
while the workflow is still inside the pipeline action.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: A stopped workflow still shows as running

1 participant