Return-Path: X-Original-To: apmail-hadoop-mapreduce-dev-archive@minotaur.apache.org Delivered-To: apmail-hadoop-mapreduce-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DBD009818 for ; Mon, 12 Dec 2011 14:23:01 +0000 (UTC) Received: (qmail 85283 invoked by uid 500); 12 Dec 2011 14:23:00 -0000 Delivered-To: apmail-hadoop-mapreduce-dev-archive@hadoop.apache.org Received: (qmail 85184 invoked by uid 500); 12 Dec 2011 14:23:00 -0000 Mailing-List: contact mapreduce-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: mapreduce-dev@hadoop.apache.org Delivered-To: mailing list mapreduce-dev@hadoop.apache.org Received: (qmail 85134 invoked by uid 99); 12 Dec 2011 14:23:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Dec 2011 14:23:00 +0000 X-ASF-Spam-Status: No, hits=-2001.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Dec 2011 14:22:52 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 61E6B10EE51 for ; Mon, 12 Dec 2011 14:22:31 +0000 (UTC) Date: Mon, 12 Dec 2011 14:22:31 +0000 (UTC) From: "Steve Loughran (Created) (JIRA)" To: mapreduce-dev@hadoop.apache.org Message-ID: <2032472900.1261.1323699751402.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Created] (MAPREDUCE-3535) Yarn service subclasses don't check for service state before executing their state change operations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Yarn service subclasses don't check for service state before executing their state change operations ---------------------------------------------------------------------------------------------------- Key: MAPREDUCE-3535 URL: https://issues.apache.org/jira/browse/MAPREDUCE-3535 Project: Hadoop Map/Reduce Issue Type: Bug Components: mrv2 Affects Versions: 0.23.0, 0.24.0 Reporter: Steve Loughran Although there are checks in the lifecycle state change methods (start, stop, ...), they only get checked in the superclass. The subclasses don't check it; they don't exit the start() method if they are already started, and they don't bail out early on a stop if they are already stopped -even when the superclass returns without doing anything. This means that calling {{Service.start()}} twice may leak resources, {{Service.start()}} twice try to shut down twice, etc. And that's on the same thread... My preferred action here would be for the ave the operations return true if a state change took place, the implementation would be synchronised and return the correct value The subclasses look for this and only execute their state changes took place e.g {code} boolean start() { if (!super.start()) return false; //do my own startup return true; } {code} The {{Service.stop()}} operation is trickier as the subclasses tend to call the superclass last for a better unwinding. I think it may be safer to work the other way around, but code reviews would be need to ensure that this doesn't break assumptions in the subclass about termination order. It may be possible to do more complex designs, but it is hard to chain this down a hierarchy of classes. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira