Return-Path: Delivered-To: apmail-hadoop-core-dev-archive@www.apache.org Received: (qmail 67549 invoked from network); 27 Jul 2008 00:32:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Jul 2008 00:32:58 -0000 Received: (qmail 33526 invoked by uid 500); 27 Jul 2008 00:32:52 -0000 Delivered-To: apmail-hadoop-core-dev-archive@hadoop.apache.org Received: (qmail 33494 invoked by uid 500); 27 Jul 2008 00:32:52 -0000 Mailing-List: contact core-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: core-dev@hadoop.apache.org Delivered-To: mailing list core-dev@hadoop.apache.org Received: (qmail 33483 invoked by uid 99); 27 Jul 2008 00:32:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 26 Jul 2008 17:32:51 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 27 Jul 2008 00:32:05 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id BC7F8234C186 for ; Sat, 26 Jul 2008 17:32:31 -0700 (PDT) Message-ID: <774557344.1217118751770.JavaMail.jira@brutus> Date: Sat, 26 Jul 2008 17:32:31 -0700 (PDT) From: "dhruba borthakur (JIRA)" To: core-dev@hadoop.apache.org Subject: [jira] Commented: (HADOOP-3818) Not possible to access a FileSystem from within a ShutdownHook In-Reply-To: <157389230.1216841731677.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HADOOP-3818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12617227#action_12617227 ] dhruba borthakur commented on HADOOP-3818: ------------------------------------------ My experience is that it is better If the appliction uses deleteOnExit, rather than depend on the behaviour of the shutdown hook. does that work for you? > Not possible to access a FileSystem from within a ShutdownHook > -------------------------------------------------------------- > > Key: HADOOP-3818 > URL: https://issues.apache.org/jira/browse/HADOOP-3818 > Project: Hadoop Core > Issue Type: Bug > Components: fs > Affects Versions: 0.17.1 > Reporter: Rowan Nairn > Priority: Minor > > FileSystem uses addShutdownHook to close all FileSystems at exit. This makes it impossible to access a FileSystem from within your own ShutdownHook threads, say for deleting incomplete output. Using a pre-existing FileSystem object is unsafe since it may be closed by the time the thread executes. Using FileSystem.get(...) results in an exception: > Exception in thread "Thread-10" java.lang.IllegalStateException: Shutdown in progress > at java.lang.Shutdown.add(Shutdown.java:81) > at java.lang.Runtime.addShutdownHook(Runtime.java:190) > at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1293) > at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:203) > at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:108) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.