Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 81490 invoked from network); 8 Jul 2009 09:14:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Jul 2009 09:14:38 -0000 Received: (qmail 48625 invoked by uid 500); 8 Jul 2009 09:14:48 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 48572 invoked by uid 500); 8 Jul 2009 09:14:48 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 48562 invoked by uid 99); 8 Jul 2009 09:14:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jul 2009 09:14:48 +0000 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; Wed, 08 Jul 2009 09:14:36 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id CE48F234C1E9 for ; Wed, 8 Jul 2009 02:14:14 -0700 (PDT) Message-ID: <2041071678.1247044454844.JavaMail.jira@brutus> Date: Wed, 8 Jul 2009 02:14:14 -0700 (PDT) From: "Sean Qiu (JIRA)" To: commits@harmony.apache.org Subject: [jira] Closed: (HARMONY-5981) [classlib][logging] FileHandler may throw exception when logging to the same file by multiple thread In-Reply-To: <1143561021.1221136785102.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-5981?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Sean Qiu closed HARMONY-5981. ----------------------------- Close this pending issue. > [classlib][logging] FileHandler may throw exception when logging to the same file by multiple thread > ---------------------------------------------------------------------------------------------------- > > Key: HARMONY-5981 > URL: https://issues.apache.org/jira/browse/HARMONY-5981 > Project: Harmony > Issue Type: Bug > Components: Classlib > Affects Versions: 5.0M7 > Reporter: Sean Qiu > Assignee: Sean Qiu > Fix For: 5.0M11 > > Attachments: HARMONY-5981.diff > > > When we are trying to log by a Filehandler to publish the information into a same file,it will introduce multi-thread defect . > As a result, it will throw such exception[1] while logging. > The root cause is that the destination file may be deleted by other thread if they are not synchronized. > Below testcase[2] can reproduce the issue. > [1] > java.util.logging.ErrorManager: WRITE_FAILURE > Error message - Exception occurred when writing to the output stream. > Exception - java.io.IOException: Writer is closed. > [2] > package logging; > import java.io.File; > import java.util.logging.FileHandler; > import java.util.logging.Logger; > public class FileHandlerTest { > static class LoggingThread implements Runnable { > private Logger logger; > > public LoggingThread(Logger logger){ > this.logger = logger; > } > public void run() { > while (true) { > logger.info("Test"); > } > } > } > public static void main(String[] args) throws Exception { > Logger logger = Logger.getLogger("test"); > String path = new File(".").getAbsolutePath(); > FileHandler fh = new FileHandler(path, 3000000, 12, false); > logger.setUseParentHandlers(false); > logger.addHandler(fh); > Thread[] threads = new Thread[12]; > for (Thread thread : threads) { > thread = new Thread(new LoggingThread(logger)); > thread.start(); > } > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.