From issues-return-67896-archive-asf-public=cust-asf.ponee.io@commons.apache.org Sun May 20 01:16:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id CBB5118063B for ; Sun, 20 May 2018 01:16:04 +0200 (CEST) Received: (qmail 21700 invoked by uid 500); 19 May 2018 23:16:03 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 21689 invoked by uid 99); 19 May 2018 23:16:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 May 2018 23:16:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 451AE18027C for ; Sat, 19 May 2018 23:16:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.511 X-Spam-Level: X-Spam-Status: No, score=-109.511 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 4P2rSNFXMNCW for ; Sat, 19 May 2018 23:16:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 333FB5F359 for ; Sat, 19 May 2018 23:16:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 57B31E00C4 for ; Sat, 19 May 2018 23:16:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 15F6E21298 for ; Sat, 19 May 2018 23:16:00 +0000 (UTC) Date: Sat, 19 May 2018 23:16:00 +0000 (UTC) From: "Phil Steitz (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (POOL-337) EvictionTimer does not remove cancelled tasks from the executor, leading to an IllegalStateException when the evictor attempts to evict MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/POOL-337?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D164817= 90#comment-16481790 ]=20 Phil Steitz commented on POOL-337: ---------------------------------- Let me start with a disclaimer here.=C2=A0 I have not committed to pool in = a while and I have not worked out the details of this solution. That said, you are right, I meant BaseGenericObjectPool and basically what = you describe, changing=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 {code:java} evictor =3D new Evictor(); EvictionTimer.schedule(evictor, delay, delay); {code} in BGOP.startEvictor to=20 {code:java} evictor =3D EvictionTimer.schedule(evictor, delay, delay); {code} hence changing the type of the evictor. You are right that that requires a= change to the `EvictionTimer`=20 API but the method(s) in question are package scope, so not part of the pub= lic API, so probably OK to change in a minor release. Repeating disclaimer, I have not actually tried this or fully thought throu= gh the consequences. It would be good to get [~markt] to comment on this,= as IIRC he designed the current setup. =C2=A0 > EvictionTimer does not remove cancelled tasks from the executor, leading = to an IllegalStateException when the evictor attempts to evict > -------------------------------------------------------------------------= -------------------------------------------------------------- > > Key: POOL-337 > URL: https://issues.apache.org/jira/browse/POOL-337 > Project: Commons Pool > Issue Type: Bug > Affects Versions: 2.5.0 > Reporter: Reinald Verheij > Priority: Major > Attachments: EvictionTimer.java, EvictionTimer.java.original-from= -2.5.0.java > > > EvictionTimer does not remove cancelled tasks from the executor, leading = to an IllegalStateException when the evictor attempts to evict. > =C2=A0 > EvictionTimer::schedule() adds eviction tasks to the executor, but the ca= ncel does not remove it. This is asymmetric and leads to the following exce= ption: > {noformat} > java.lang.IllegalStateException: Pool not open > =09at org.apache.commons.pool2.impl.BaseGenericObjectPool.assertOpen(Base= GenericObjectPool.java:713) > =09at org.apache.commons.pool2.impl.GenericObjectPool.evict(GenericObject= Pool.java:721) > =09at org.apache.commons.pool2.impl.BaseGenericObjectPool$Evictor.run(Bas= eGenericObjectPool.java:1077) > =09at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:= 511) > =09at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) > =09at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTas= k.access$301(ScheduledThreadPoolExecutor.java:180) > =09at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTas= k.run(ScheduledThreadPoolExecutor.java:294) > =09at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecuto= r.java:1149) > =09at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecut= or.java:624) > =09at java.lang.Thread.run(Thread.java:748){noformat} > I think the cancel would need to remember the future which returned from = {{executor::scheduleWithFixedDelay()}} in {{schedule()}} and then do someth= ing like this (see [^EvictionTimer.java] compared to original [^EvictionT= imer.java.original-from-2.5.0.java] ) > {code:java} > if (futures.containsKey(task)) { > futures.remove(task).cancel(false); > executor.purge(); > }{code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)