Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-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 9E92C9C79 for ; Fri, 17 Feb 2012 22:47:19 +0000 (UTC) Received: (qmail 84136 invoked by uid 500); 17 Feb 2012 22:47:19 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 84110 invoked by uid 500); 17 Feb 2012 22:47:19 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 84102 invoked by uid 99); 17 Feb 2012 22:47:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Feb 2012 22:47:19 +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; Fri, 17 Feb 2012 22:47:18 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 32FDF1BD961 for ; Fri, 17 Feb 2012 22:46:58 +0000 (UTC) Date: Fri, 17 Feb 2012 22:46:58 +0000 (UTC) From: "Mike Matrigali (Updated) (JIRA)" To: derby-dev@db.apache.org Message-ID: <1032677732.52437.1329518818210.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <998631461.34493.1316178368858.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (DERBY-5416) SYSCS_COMPRESS_TABLE causes an OutOfMemoryError when the heap is full at call time and then gets mostly garbage collected later on 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/DERBY-5416?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mike Matrigali updated DERBY-5416: ---------------------------------- Urgency: Normal Any suggestions on a better way to determine if sort should use more in-memory. It seems for performance derby should be using more memory for these operations automatically, but as this issue points out operations can fail if the choice is wrong. Solutions should be zero-admin by default, with maybe tuning knobs to work around issues like this one where the default does not work. > SYSCS_COMPRESS_TABLE causes an OutOfMemoryError when the heap is full at call time and then gets mostly garbage collected later on > ---------------------------------------------------------------------------------------------------------------------------------- > > Key: DERBY-5416 > URL: https://issues.apache.org/jira/browse/DERBY-5416 > Project: Derby > Issue Type: Bug > Components: Store > Affects Versions: 10.6.2.1, 10.7.1.1, 10.8.1.2 > Reporter: Ramin Baradari > Priority: Critical > Labels: derby_triage10_9 > Attachments: compress_test_5416.patch > > > When compressing a table with an index that is larger than the maximum heap size and therefore cannot be hold in memory as a whole an OutOfMemoryError can occur. > For this to happen the heap usage must be close to the maximum heap size at the start of the index recreation and then while the entries are sorted a garbage collection run must clean out most of the heap. This can happen because a concurrent process releases a huge chunk of memory or just because the buffer of a previous table compression has not yet been garbage collected. > The internally used heuristics to guess when more memory can be used for the merge inserter estimates that more memory is available and then the sort buffer gets doubled. The buffer size gets doubled until the heap usage is back to the level when the merge inserter was first initialized or when the OOM occurs. > The problem lies in MergeInsert.insert(...). The check if the buffer can be doubled contains the expression "estimatedMemoryUsed < 0" where estimatedMemoryUsed is the difference in current heap usage and heap usage at initialization. Unfortunately, in the aforementioned scenario this will be true until the heap usage will reach close to maximum heap size before doubling the buffer size will be stopped. > I've tested it with 10.6.2.1, 10.7.1.1 and 10.8.1.2 but the actual bug most likely exists in prior versions too. -- 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