You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Joel Koshy (JIRA)" <ji...@apache.org> on 2011/09/01 01:59:09 UTC
[jira] [Created] (KAFKA-126) Log flush should complete upon broker
shutdown
Log flush should complete upon broker shutdown
----------------------------------------------
Key: KAFKA-126
URL: https://issues.apache.org/jira/browse/KAFKA-126
Project: Kafka
Issue Type: Bug
Reporter: Joel Koshy
Broker shutdown currently forces the flush scheduler to shutdown(Now). This leads to an unclean shutdown. cleanupLogs may be affected by a similar scenario.
2011/08/31 09:45:34.833 ERROR [LogManager] [kafka-logflusher-0] [kafka] Error flushing topic MyTopic
java.nio.channels.ClosedByInterruptException
at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
at sun.nio.ch.FileChannelImpl.force(FileChannelImpl.java:362)
at kafka.message.FileMessageSet.flush(FileMessageSet.scala:174)
at kafka.log.Log.flush(Log.scala:306)
at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:274)
at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:263)
at scala.collection.Iterator$class.foreach(Iterator.scala:631)
at kafka.utils.IteratorTemplate.foreach(IteratorTemplate.scala:30)
at kafka.log.LogManager.kafka$log$LogManager$$flushAllLogs(LogManager.scala:263)
at kafka.log.LogManager$$anonfun$startup$1.apply$mcV$sp(LogManager.scala:129)
at kafka.utils.Utils$$anon$2.run(Utils.scala:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
A possible fix this would be to use shutdown() instead of shutdownNow() in the scheduler.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (KAFKA-126) Log flush should complete upon broker
shutdown
Posted by "Jun Rao (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jun Rao updated KAFKA-126:
--------------------------
Resolution: Fixed
Fix Version/s: 0.7
Status: Resolved (was: Patch Available)
Thanks, Joel. Just committed this.
> Log flush should complete upon broker shutdown
> ----------------------------------------------
>
> Key: KAFKA-126
> URL: https://issues.apache.org/jira/browse/KAFKA-126
> Project: Kafka
> Issue Type: Bug
> Reporter: Joel Koshy
> Fix For: 0.7
>
> Attachments: KAFKA-126_v1.patch, KAFKA-126_v2.patch, KAFKA-126_v3.patch
>
>
> Broker shutdown currently forces the flush scheduler to shutdown(Now). This leads to an unclean shutdown. cleanupLogs may be affected by a similar scenario.
> 2011/08/31 09:45:34.833 ERROR [LogManager] [kafka-logflusher-0] [kafka] Error flushing topic MyTopic
> java.nio.channels.ClosedByInterruptException
> at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
> at sun.nio.ch.FileChannelImpl.force(FileChannelImpl.java:362)
> at kafka.message.FileMessageSet.flush(FileMessageSet.scala:174)
> at kafka.log.Log.flush(Log.scala:306)
> at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:274)
> at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:263)
> at scala.collection.Iterator$class.foreach(Iterator.scala:631)
> at kafka.utils.IteratorTemplate.foreach(IteratorTemplate.scala:30)
> at kafka.log.LogManager.kafka$log$LogManager$$flushAllLogs(LogManager.scala:263)
> at kafka.log.LogManager$$anonfun$startup$1.apply$mcV$sp(LogManager.scala:129)
> at kafka.utils.Utils$$anon$2.run(Utils.scala:58)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> A possible fix this would be to use shutdown() instead of shutdownNow() in the scheduler.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (KAFKA-126) Log flush should complete upon broker
shutdown
Posted by "Joel Koshy (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joel Koshy updated KAFKA-126:
-----------------------------
Attachment: KAFKA-126_v3.patch
Oops - forgot to rebase.
> Log flush should complete upon broker shutdown
> ----------------------------------------------
>
> Key: KAFKA-126
> URL: https://issues.apache.org/jira/browse/KAFKA-126
> Project: Kafka
> Issue Type: Bug
> Reporter: Joel Koshy
> Attachments: KAFKA-126_v1.patch, KAFKA-126_v2.patch, KAFKA-126_v3.patch
>
>
> Broker shutdown currently forces the flush scheduler to shutdown(Now). This leads to an unclean shutdown. cleanupLogs may be affected by a similar scenario.
> 2011/08/31 09:45:34.833 ERROR [LogManager] [kafka-logflusher-0] [kafka] Error flushing topic MyTopic
> java.nio.channels.ClosedByInterruptException
> at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
> at sun.nio.ch.FileChannelImpl.force(FileChannelImpl.java:362)
> at kafka.message.FileMessageSet.flush(FileMessageSet.scala:174)
> at kafka.log.Log.flush(Log.scala:306)
> at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:274)
> at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:263)
> at scala.collection.Iterator$class.foreach(Iterator.scala:631)
> at kafka.utils.IteratorTemplate.foreach(IteratorTemplate.scala:30)
> at kafka.log.LogManager.kafka$log$LogManager$$flushAllLogs(LogManager.scala:263)
> at kafka.log.LogManager$$anonfun$startup$1.apply$mcV$sp(LogManager.scala:129)
> at kafka.utils.Utils$$anon$2.run(Utils.scala:58)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> A possible fix this would be to use shutdown() instead of shutdownNow() in the scheduler.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (KAFKA-126) Log flush should complete upon
broker shutdown
Posted by "Jun Rao (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13108788#comment-13108788 ]
Jun Rao commented on KAFKA-126:
-------------------------------
Thanks Joel for the patch. The zookeeper offset committer should use shutdownNow. If there is anything wrong with ZK server, we still want to be able to shut down a consumer immedidately.
> Log flush should complete upon broker shutdown
> ----------------------------------------------
>
> Key: KAFKA-126
> URL: https://issues.apache.org/jira/browse/KAFKA-126
> Project: Kafka
> Issue Type: Bug
> Reporter: Joel Koshy
> Attachments: KAFKA-126_v1.patch
>
>
> Broker shutdown currently forces the flush scheduler to shutdown(Now). This leads to an unclean shutdown. cleanupLogs may be affected by a similar scenario.
> 2011/08/31 09:45:34.833 ERROR [LogManager] [kafka-logflusher-0] [kafka] Error flushing topic MyTopic
> java.nio.channels.ClosedByInterruptException
> at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
> at sun.nio.ch.FileChannelImpl.force(FileChannelImpl.java:362)
> at kafka.message.FileMessageSet.flush(FileMessageSet.scala:174)
> at kafka.log.Log.flush(Log.scala:306)
> at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:274)
> at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:263)
> at scala.collection.Iterator$class.foreach(Iterator.scala:631)
> at kafka.utils.IteratorTemplate.foreach(IteratorTemplate.scala:30)
> at kafka.log.LogManager.kafka$log$LogManager$$flushAllLogs(LogManager.scala:263)
> at kafka.log.LogManager$$anonfun$startup$1.apply$mcV$sp(LogManager.scala:129)
> at kafka.utils.Utils$$anon$2.run(Utils.scala:58)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> A possible fix this would be to use shutdown() instead of shutdownNow() in the scheduler.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (KAFKA-126) Log flush should complete upon broker
shutdown
Posted by "Joel Koshy (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joel Koshy updated KAFKA-126:
-----------------------------
Attachment: KAFKA-126_v2.patch
That makes sense. Here is the updated patch.
> Log flush should complete upon broker shutdown
> ----------------------------------------------
>
> Key: KAFKA-126
> URL: https://issues.apache.org/jira/browse/KAFKA-126
> Project: Kafka
> Issue Type: Bug
> Reporter: Joel Koshy
> Attachments: KAFKA-126_v1.patch, KAFKA-126_v2.patch
>
>
> Broker shutdown currently forces the flush scheduler to shutdown(Now). This leads to an unclean shutdown. cleanupLogs may be affected by a similar scenario.
> 2011/08/31 09:45:34.833 ERROR [LogManager] [kafka-logflusher-0] [kafka] Error flushing topic MyTopic
> java.nio.channels.ClosedByInterruptException
> at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
> at sun.nio.ch.FileChannelImpl.force(FileChannelImpl.java:362)
> at kafka.message.FileMessageSet.flush(FileMessageSet.scala:174)
> at kafka.log.Log.flush(Log.scala:306)
> at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:274)
> at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:263)
> at scala.collection.Iterator$class.foreach(Iterator.scala:631)
> at kafka.utils.IteratorTemplate.foreach(IteratorTemplate.scala:30)
> at kafka.log.LogManager.kafka$log$LogManager$$flushAllLogs(LogManager.scala:263)
> at kafka.log.LogManager$$anonfun$startup$1.apply$mcV$sp(LogManager.scala:129)
> at kafka.utils.Utils$$anon$2.run(Utils.scala:58)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> A possible fix this would be to use shutdown() instead of shutdownNow() in the scheduler.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (KAFKA-126) Log flush should complete upon broker
shutdown
Posted by "Joel Koshy (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joel Koshy updated KAFKA-126:
-----------------------------
Status: Patch Available (was: Open)
> Log flush should complete upon broker shutdown
> ----------------------------------------------
>
> Key: KAFKA-126
> URL: https://issues.apache.org/jira/browse/KAFKA-126
> Project: Kafka
> Issue Type: Bug
> Reporter: Joel Koshy
> Attachments: KAFKA-126_v1.patch
>
>
> Broker shutdown currently forces the flush scheduler to shutdown(Now). This leads to an unclean shutdown. cleanupLogs may be affected by a similar scenario.
> 2011/08/31 09:45:34.833 ERROR [LogManager] [kafka-logflusher-0] [kafka] Error flushing topic MyTopic
> java.nio.channels.ClosedByInterruptException
> at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
> at sun.nio.ch.FileChannelImpl.force(FileChannelImpl.java:362)
> at kafka.message.FileMessageSet.flush(FileMessageSet.scala:174)
> at kafka.log.Log.flush(Log.scala:306)
> at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:274)
> at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:263)
> at scala.collection.Iterator$class.foreach(Iterator.scala:631)
> at kafka.utils.IteratorTemplate.foreach(IteratorTemplate.scala:30)
> at kafka.log.LogManager.kafka$log$LogManager$$flushAllLogs(LogManager.scala:263)
> at kafka.log.LogManager$$anonfun$startup$1.apply$mcV$sp(LogManager.scala:129)
> at kafka.utils.Utils$$anon$2.run(Utils.scala:58)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> A possible fix this would be to use shutdown() instead of shutdownNow() in the scheduler.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (KAFKA-126) Log flush should complete upon broker
shutdown
Posted by "Joel Koshy (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joel Koshy updated KAFKA-126:
-----------------------------
Attachment: KAFKA-126_v1.patch
This is pretty much the simple fix that I suggested in the description. i.e., change the shutdown behavior of KafkaScheduler to use shutdown() instead of shutdownNow(). I also added a shutdownNow() method to KafkaScheduler for access to the immediate shutdown behavior.
For testing: I changed the flush settings to:
log.flush.interval=10000
log.default.flush.interval.ms=0
log.default.flush.scheduler.interval.ms=20
ran ProducerPerformance and shut down the broker a couple of times. These settings consistently reproduce the exception without this fix.
The other usages of shutdown (now called shutdownNow) are by the zookeeper offset committer, and the LogManager's log cleanup. I think these schedulers should also switch to using shutdown() and that is accomplished by this patch.
Finally, I'm piggy backing an small unrelated warning message in the producer config - i.e. when both zk.connect and broker.list are specified, zk.connect takes precedence. (Let me know if you prefer this to be removed from this patch.)
> Log flush should complete upon broker shutdown
> ----------------------------------------------
>
> Key: KAFKA-126
> URL: https://issues.apache.org/jira/browse/KAFKA-126
> Project: Kafka
> Issue Type: Bug
> Reporter: Joel Koshy
> Attachments: KAFKA-126_v1.patch
>
>
> Broker shutdown currently forces the flush scheduler to shutdown(Now). This leads to an unclean shutdown. cleanupLogs may be affected by a similar scenario.
> 2011/08/31 09:45:34.833 ERROR [LogManager] [kafka-logflusher-0] [kafka] Error flushing topic MyTopic
> java.nio.channels.ClosedByInterruptException
> at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
> at sun.nio.ch.FileChannelImpl.force(FileChannelImpl.java:362)
> at kafka.message.FileMessageSet.flush(FileMessageSet.scala:174)
> at kafka.log.Log.flush(Log.scala:306)
> at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:274)
> at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:263)
> at scala.collection.Iterator$class.foreach(Iterator.scala:631)
> at kafka.utils.IteratorTemplate.foreach(IteratorTemplate.scala:30)
> at kafka.log.LogManager.kafka$log$LogManager$$flushAllLogs(LogManager.scala:263)
> at kafka.log.LogManager$$anonfun$startup$1.apply$mcV$sp(LogManager.scala:129)
> at kafka.utils.Utils$$anon$2.run(Utils.scala:58)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> A possible fix this would be to use shutdown() instead of shutdownNow() in the scheduler.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (KAFKA-126) Log flush should complete upon
broker shutdown
Posted by "Neha Narkhede (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/KAFKA-126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13105804#comment-13105804 ]
Neha Narkhede commented on KAFKA-126:
-------------------------------------
Using the executor shutdown API, the process would block until the currently executing thread finishes execution. I guess that works fine unless for some odd reason, the thread blocks on one action forever, in which case the process would have to be killed manually. I can't imagine of a concrete example of when it could block forever though.
On the other hand, I guess that if/when that kind of blocking happens, it is a serious problem/bug that needs attention anyways. So using the shutdown() API looks like a good approach.
+1
> Log flush should complete upon broker shutdown
> ----------------------------------------------
>
> Key: KAFKA-126
> URL: https://issues.apache.org/jira/browse/KAFKA-126
> Project: Kafka
> Issue Type: Bug
> Reporter: Joel Koshy
> Attachments: KAFKA-126_v1.patch
>
>
> Broker shutdown currently forces the flush scheduler to shutdown(Now). This leads to an unclean shutdown. cleanupLogs may be affected by a similar scenario.
> 2011/08/31 09:45:34.833 ERROR [LogManager] [kafka-logflusher-0] [kafka] Error flushing topic MyTopic
> java.nio.channels.ClosedByInterruptException
> at java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
> at sun.nio.ch.FileChannelImpl.force(FileChannelImpl.java:362)
> at kafka.message.FileMessageSet.flush(FileMessageSet.scala:174)
> at kafka.log.Log.flush(Log.scala:306)
> at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:274)
> at kafka.log.LogManager$$anonfun$kafka$log$LogManager$$flushAllLogs$1.apply(LogManager.scala:263)
> at scala.collection.Iterator$class.foreach(Iterator.scala:631)
> at kafka.utils.IteratorTemplate.foreach(IteratorTemplate.scala:30)
> at kafka.log.LogManager.kafka$log$LogManager$$flushAllLogs(LogManager.scala:263)
> at kafka.log.LogManager$$anonfun$startup$1.apply$mcV$sp(LogManager.scala:129)
> at kafka.utils.Utils$$anon$2.run(Utils.scala:58)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
> at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
> at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> A possible fix this would be to use shutdown() instead of shutdownNow() in the scheduler.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira