Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-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 F203C7DF6 for ; Wed, 23 Nov 2011 12:12:01 +0000 (UTC) Received: (qmail 9921 invoked by uid 500); 23 Nov 2011 12:12:00 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 9881 invoked by uid 500); 23 Nov 2011 12:12:00 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 9874 invoked by uid 99); 23 Nov 2011 12:12:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Nov 2011 12:12:00 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RISK_FREE,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, 23 Nov 2011 12:11:59 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id BA98499955 for ; Wed, 23 Nov 2011 12:11:39 +0000 (UTC) Date: Wed, 23 Nov 2011 12:11:39 +0000 (UTC) From: "Uwe Schindler (Updated) (JIRA)" To: dev@lucene.apache.org Message-ID: <1060307469.5749.1322050299765.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <151188765.4586.1322008359958.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (LUCENE-3588) Try harder to prevent SIGSEGV on cloned MMapIndexInputs 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/LUCENE-3588?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Uwe Schindler updated LUCENE-3588: ---------------------------------- Attachment: LUCENE-3588-simpler.patch Improved patch: - The clones (even clones of clones) share all the same WeakHashMap with the original. Only the original MMapIndexInput will unset the buffers in all clones/cloned-clones. - This reduces cost of creating clones (no HashMap instantiation, no ReferenceQueues,...) Added test with clone of clone. > Try harder to prevent SIGSEGV on cloned MMapIndexInputs > ------------------------------------------------------- > > Key: LUCENE-3588 > URL: https://issues.apache.org/jira/browse/LUCENE-3588 > Project: Lucene - Java > Issue Type: Improvement > Components: core/store > Affects Versions: 3.4, 3.5 > Reporter: Uwe Schindler > Assignee: Uwe Schindler > Fix For: 3.6, 4.0 > > Attachments: LUCENE-3588-simpler.patch, LUCENE-3588-simpler.patch, LUCENE-3588.patch, LUCENE-3588.patch > > > We are unmapping mmapped byte buffers which is disallowed by the JDK, because it has the risk of SIGSEGV when you access the mapped byte buffer after unmapping. > We currently prevent this for the main IndexInput by setting its buffer to null, so we NPE if somebody tries to access the underlying buffer. I recently fixed also the stupid curBuf (LUCENE-3200) by setting to null. > The big problem are cloned IndexInputs which are generally not closed. Those still contain references to the unmapped ByteBuffer, which lead to SIGSEGV easily. The patch from Mike in LUCENE-3439 prevents most of this in Lucene 3.5, but its still not 100% safe (as it uses non-volatiles). > This patch will fix the remaining issues by also setting the buffers of clones to null when the original is closed. The trick is to record weak references of all clones created and close them together with the original. This uses a ConcurrentHashMap,?> as store with the logic borrowed from WeakHashMap to cleanup the GCed references (using ReferenceQueue). > If we respin 3.5, we should maybe also get this in. -- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org