[
https://issues.apache.org/jira/browse/SAMZA-513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14284982#comment-14284982
]
Chris Riccomini commented on SAMZA-513:
---------------------------------------
In KAFKA-1886, [~auradkar] tried to reproduce this on the Kafka-side.
SimpleConsumer does swallow the ClosedByInterruptException, but the Thread's
interrupt flag is never reset. The SimpleConsumer always seems to then fail
with ClosedChannelException when it retries.
I tried to replicate this in the following unit test in
TestExponentialSleepStrategy:
{code}
@Test def testClosedByInterruptException {
val strategy = new ExponentialSleepStrategy()
var gotInterrupt = false
strategy.run(
loop => {
try {
Thread.currentThread().interrupt()
throw new java.nio.channels.ClosedByInterruptException()
} catch {
case (e: Throwable) =>
throw new java.nio.channels.ClosedChannelException
}
},
(exception, loop) => {
})
}
{code}
But, the sleep strategy behaves as expected. This loop ends.
> BrokerProxy doesn't shut down
> -----------------------------
>
> Key: SAMZA-513
> URL: https://issues.apache.org/jira/browse/SAMZA-513
> Project: Samza
> Issue Type: Bug
> Components: container
> Affects Versions: 0.8.0
> Reporter: Zach Cox
>
> In BrokerProxy.stop, the call to thread.interrupt doesn't always lead to a
> real thread interruption, which can cause shut down to not occur. One
> workaround is to repeatedly call thread.interrupt in a tight while loop until
> thread.isAlive returns false.
> Related mailing list thread:
> http://www.mail-archive.com/[email protected]/msg02255.html
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)