Return-Path: X-Original-To: apmail-kafka-dev-archive@www.apache.org Delivered-To: apmail-kafka-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 42671E51F for ; Tue, 5 Feb 2013 17:58:12 +0000 (UTC) Received: (qmail 25691 invoked by uid 500); 5 Feb 2013 17:58:12 -0000 Delivered-To: apmail-kafka-dev-archive@kafka.apache.org Received: (qmail 25655 invoked by uid 500); 5 Feb 2013 17:58:12 -0000 Mailing-List: contact dev-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kafka.apache.org Delivered-To: mailing list dev@kafka.apache.org Received: (qmail 25641 invoked by uid 99); 5 Feb 2013 17:58:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Feb 2013 17:58:12 +0000 Date: Tue, 5 Feb 2013 17:58:11 +0000 (UTC) From: "Sriram Subramanian (JIRA)" To: dev@kafka.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (KAFKA-749) Bug in socket server shutdown logic makes the broker hang on shutdown until it has to be killed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/KAFKA-749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13571511#comment-13571511 ] Sriram Subramanian commented on KAFKA-749: ------------------------------------------ If that works fine. But it looks like there really is a solution that does not need any constraints. 1. SocketServer on shutdown closes the acceptor and processor threads. It can then add a alldone request to the queue. 2. Each requesthandler thread just dequeues from the request queue. If it is alldone, it just re-enqueues it and exits. 3. requesthandler shutdown just waits for all threads to exit (this is same as today). Will this not work? > Bug in socket server shutdown logic makes the broker hang on shutdown until it has to be killed > ----------------------------------------------------------------------------------------------- > > Key: KAFKA-749 > URL: https://issues.apache.org/jira/browse/KAFKA-749 > Project: Kafka > Issue Type: Bug > Components: network > Affects Versions: 0.8 > Reporter: Neha Narkhede > Assignee: Neha Narkhede > Priority: Blocker > Labels: bugs, p1 > Attachments: kafka-749-v1.patch > > Original Estimate: 24h > Remaining Estimate: 24h > > The current shutdown logic of the server shuts down the io threads first, followed by acceptor and finally processor threads. The shutdown API of io threads enqueues a special AllDone command into the common request queue. It shuts down the io thread when it dequeues this special all done command. What can happen is that while this shutdown command processing is happening on the io threads, the network/processor threads can still accept new connections and requests and will add those new requests to the request queue. That means, more requests can be enqueued after the AllDone command. What happens is that after the io threads have shutdown, there is no thread available to dequeue from the request queue. So the processor threads can hang while adding new requests to a full request queue, thereby blocking the server from shutting down. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira