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 DC3659047 for ; Thu, 1 Mar 2012 10:25:04 +0000 (UTC) Received: (qmail 9583 invoked by uid 500); 1 Mar 2012 10:25:03 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 9538 invoked by uid 500); 1 Mar 2012 10:25:03 -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 9530 invoked by uid 99); 1 Mar 2012 10:25:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2012 10:25:03 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of dawid.weiss@gmail.com designates 209.85.210.176 as permitted sender) Received: from [209.85.210.176] (HELO mail-iy0-f176.google.com) (209.85.210.176) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Mar 2012 10:24:56 +0000 Received: by iagw33 with SMTP id w33so761373iag.35 for ; Thu, 01 Mar 2012 02:24:35 -0800 (PST) Received-SPF: pass (google.com: domain of dawid.weiss@gmail.com designates 10.50.207.65 as permitted sender) client-ip=10.50.207.65; Authentication-Results: mr.google.com; spf=pass (google.com: domain of dawid.weiss@gmail.com designates 10.50.207.65 as permitted sender) smtp.mail=dawid.weiss@gmail.com; dkim=pass header.i=dawid.weiss@gmail.com Received: from mr.google.com ([10.50.207.65]) by 10.50.207.65 with SMTP id lu1mr142671igc.3.1330597475248 (num_hops = 1); Thu, 01 Mar 2012 02:24:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=3UGLSuUklCr1IqLmd2QvPE5qB0GtSOYPk+4htASP7gU=; b=kergpmm1NgPQBGyzW/N6C3PU0UXrbqE9H1Yu9ekE8MEWpRKrW1uu1k0VvnL7DFJM41 bXiA+NMzZ2h6+tRo5VbnTRIAL+ehCSwo9Xo0ZrXwdB+I5Uy83HNw6xhk2dCWRWREjeCZ e5+ptaDNZJcN6FgR87kGv+lzDxoOO7GM7D584= Received: by 10.50.207.65 with SMTP id lu1mr117137igc.3.1330597475200; Thu, 01 Mar 2012 02:24:35 -0800 (PST) MIME-Version: 1.0 Received: by 10.42.167.198 with HTTP; Thu, 1 Mar 2012 02:24:15 -0800 (PST) From: Dawid Weiss Date: Thu, 1 Mar 2012 11:24:15 +0100 Message-ID: Subject: ThreadPool threads leaking to suite scope. To: dev@lucene.apache.org Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org Question -- TestPhraseQuery has a static @BeforeClass initialized searcher. With a certain seed this searcher is now initialized with an underlying ThreadPool but the threadpool's threads (even though it's a fixed TP) don't get preallocated until the first job is submitted (executor's contract). What this causes is a thread leak - like behavior because from the test's viewpoint the number of threads on the entry and exit don't match. I see two options here: 1) initialize threads eagerly; use ThreadPoolExecutor and call prestartAllCoreThreads. this could be applied to LTC on the trunk. 2) RandomizedRunner allows tests to leak threads to the suite scope (which then must add up to zero on exit). I temporarily did this on rr branch: @ThreadLeaks(linger = 1000, leakedThreadsBelongToSuite = true) Lingering is required because thread pools do not wait for their threads to actually die (all they do is they leave them to die, but not join). This could also be fixed on LTC level by joining all threads started by that custom thread factory. Dawid --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org