Github user srdo commented on the issue:
https://github.com/apache/storm/pull/1821
@hmcl The code as is will work fine in distributed mode. The problem is
when you're using the spout in an integration test, or are running the cluster
in local mode for some other reason.
When you're running an integration test in local mode, exceptions thrown by
the executors are propagated to the testing code. If we don't catch and handle
InterruptException the testing code has to handle this exception itself during
shutdown. As far as I can tell (not sure though), the local mode code also
stops shutting down executor threads once one of them throws an exception, so
throwing exceptions from the spout might prevent other executor threads from
being shut down. This is less of an issue if it only happens when a real error
occurs, but it's not great if it happens randomly when this spout is shut down.
Either way, there's no reason we shouldn't handle InterruptException internally
in the spout instead of showing it to users.
We didn't do it in the old spout because the old spout would be throwing
InterruptedException (the built-in Java exception), and not InterruptException
(the Kafka-specific exception that Storm doesn't know about). So when the old
spout shut down, any InterruptedException would be caught by the check here
https://github.com/apache/storm/blob/master/storm-core/src/jvm/org/apache/storm/utils/Utils.java#L2181,
which would let the cluster shut down cleanly.
About the last line in my previous comment: The exception being wrapped is
a new Java InterruptedException, not a Kafka InterruptException. The point is
to convert the InterruptException, which is semantically identical to Java's
InterruptedException, into a form so Storm will treat it like a normal
InterruptedException (which it essentially is).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---