Return-Path: Delivered-To: apmail-hadoop-hdfs-issues-archive@minotaur.apache.org Received: (qmail 18475 invoked from network); 16 Mar 2011 17:47:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 16 Mar 2011 17:47:52 -0000 Received: (qmail 50683 invoked by uid 500); 16 Mar 2011 17:47:51 -0000 Delivered-To: apmail-hadoop-hdfs-issues-archive@hadoop.apache.org Received: (qmail 50592 invoked by uid 500); 16 Mar 2011 17:47:51 -0000 Mailing-List: contact hdfs-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-issues@hadoop.apache.org Delivered-To: mailing list hdfs-issues@hadoop.apache.org Received: (qmail 50454 invoked by uid 99); 16 Mar 2011 17:47:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Mar 2011 17:47:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_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; Wed, 16 Mar 2011 17:47:50 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 0CA183ACC65 for ; Wed, 16 Mar 2011 17:47:30 +0000 (UTC) Date: Wed, 16 Mar 2011 17:47:30 +0000 (UTC) From: "Suresh Srinivas (JIRA)" To: hdfs-issues@hadoop.apache.org Message-ID: <1638820015.7036.1300297650048.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1322755091.5714.1300238129786.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] Updated: (HDFS-1758) Web UI JSP pages thread safety issue 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/HDFS-1758?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Suresh Srinivas updated HDFS-1758: ---------------------------------- Affects Version/s: 0.20.203.1 Fix Version/s: 0.20.4 Hadoop Flags: [Reviewed] > Web UI JSP pages thread safety issue > ------------------------------------ > > Key: HDFS-1758 > URL: https://issues.apache.org/jira/browse/HDFS-1758 > Project: Hadoop HDFS > Issue Type: Bug > Components: tools > Affects Versions: 0.20.203.1 > Environment: branch-20-security > Reporter: Tanping Wang > Assignee: Tanping Wang > Priority: Minor > Fix For: 0.20.4 > > Attachments: HDFS-1758.patch > > > The set of JSP pages that web UI uses are not thread safe. We have observed some problems when requesting Live/Dead/Decommissioning pages from the web UI, incorrect page is displayed. To be more specific, requesting Dead node list page, sometimes, Live node page is returned. Requesting decommissioning page, sometimes, dead page is returned. > The root cause of this problem is that JSP page is not thread safe by default. When multiple requests come in, each request is assigned to a different thread, multiple threads access the same instance of the servlet class resulted from a JSP page. A class variable is shared by multiple threads. The JSP code in 20 branche, for example, dfsnodelist.jsp has > {code} > int rowNum = 0; > int colNum = 0; > String sorterField = null; > String sorterOrder = null; > String whatNodes = "LIVE"; > ... > %> > {code} > declared as class variables. ( These set of variables are declared within <%! code %> directives which made them class members. ) Multiple threads share the same set of class member variables, one request would step on anther's toe. > However, due to the JSP code refactor, HADOOP-5857, all of these class member variables are moved to become function local variables. So this bug does not appear in Apache trunk. Hence, we have proposed to take a simple fix for this bug on 20 branch alone, to be more specific, branch-0.20-security. > The simple fix is to add jsp ThreadSafe="false" directive into the related JSP pages, dfshealth.jsp and dfsnodelist.jsp to make them thread safe, i.e. only on request is processed at each time. > We did evaluate the thread safety issue for other JSP pages on trunk, we noticed a potential problem is that when we retrieving some statistics from namenode, for example, we make the call to > {code} > NamenodeJspHelper.getInodeLimitText(fsn); > {code} > in dfshealth.jsp, which eventuality is > {code} > static String getInodeLimitText(FSNamesystem fsn) { > long inodes = fsn.dir.totalInodes(); > long blocks = fsn.getBlocksTotal(); > long maxobjects = fsn.getMaxObjects(); > .... > {code} > some of the function calls are already guarded by readwritelock, e.g. dir.totalInodes, but others are not. As a result of this, the web ui results are not 100% thread safe. But after evaluating the prons and cons of adding a giant lock into the JSP pages, we decided not to issue FSNamesystem ReadWrite locks into JSPs. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira