Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 7DE8DA5CB38 for ; Wed, 15 Feb 2012 08:50:21 -0400 (AST) Received: from mail-ey0-f174.google.com ([209.85.215.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RxeJQ-0002D2-5u for pgsql-jdbc@postgresql.org; Wed, 15 Feb 2012 12:50:21 +0000 Received: by eaah12 with SMTP id h12so324268eaa.19 for ; Wed, 15 Feb 2012 04:50:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=x63i6Ky32hZiYy+La4apSA08CNTsy5Hcv0Q/gbZEYO0=; b=r5gacKBiIWsqoVBnh/RED1bdb8Sc/rFR9QktFxK3s7C7CWjN0EWqRvLFq8lv0o+Ar5 FPVFLVQU8SPcl0EXQCZu7KFDw03ncBqisTzq5UoikZVTyNMy+TLsMHvCuHCz3WJygZvG 3EncufuwPklZjTyKPvdqBAuJnOydeFH/Eoaxw= Received: by 10.14.17.213 with SMTP id j61mr8457744eej.110.1329310207070; Wed, 15 Feb 2012 04:50:07 -0800 (PST) Received: from [10.64.1.26] ([94.45.140.16]) by mx.google.com with ESMTPS id z47sm10792135eeh.9.2012.02.15.04.50.05 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 15 Feb 2012 04:50:06 -0800 (PST) Message-ID: <4F3BAA22.1040103@gmail.com> Date: Wed, 15 Feb 2012 14:50:42 +0200 From: Vitalii Tymchyshyn User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.26) Gecko/20120131 Lightning/1.0b2 Thunderbird/3.1.18 MIME-Version: 1.0 To: Imran CC: Dave Cramer , Kevin Grittner , pgsql-jdbc@postgresql.org Subject: Re: non-trivial finalize() on AbstractJdbc2Statement References: <4F390FF2.2040500@gmail.com> <4F38EAC5020000250004545C@gw.wicourts.gov> <4F3B9747.2010804@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.3 (--) X-Archive-Number: 201202/63 X-Sequence-Number: 22716 15.02.12 14:30, Imran написав(ла): > @Vitalli - w.r.t Thread priority, I've tried to get the priority off > the jvm I'm running, but the thread dump nor jconsole/jvisualvm is > giving this out to me. We run 1.6.0_12 on a 64bit linux platform. > jvisualvm however shows that the Running percentage of the Finalizer > thread is comparatively low. To my knowledge Finalizer thread is low > by default, and looking at the Finalizer code, it does appear to be > setting the priority to MAX_PRIORITY - 2. > Anyways that aside, heap dumps I've collected when we had OOMs have > pointed at high Finalizer objects and the referent of those have been > jdbc3Satement objects, which is why I raised this question. I'm not > sure if its common practice to always use finalize() for any mop-up > tasks, as I've seen other cautions raised around it, although I can > see there are valid cases to do so. jstack shows you thread priorities. For me: Regular thread: "Thread-69" daemon prio=10 tid=0x000000004683e800 nid=0x6834 waiting on condition [0x00007f80a7649000] Finalizer: "Finalizer" daemon prio=10 tid=0x00007f80c4001000 nid=0x6d35 in Object.wait() [0x00007f80c9747000] So, priorities are equal. Regarding heap sizes, that's what I am talking about! If someone holds Finalizer thread, especially in some blocking state (say synchronized) you will get OOM with a lot of objects that are created much, not ones that really holds the thread! That's why it's Running is low - someone it blocking on something in this thread. Otherwise if it has work, it would be in running state, no matter is OS've given it CPU time. Check it with jstack. You can do it even now, while you don't have OOMs you should still have the problem root - someone who is sitting in the finalizer doing it's work slow. You may even still have some leak, yet now while you have much less finalizable objects, the leak is much less visible. Note that you may not see it at single call if your cause does not take 100% of Finalizer thread time. BTW: You can try to find the object being finalized from heap dump, check all objects visible from finalizer thread. Best regards, Vitalii Tymchyshyn