From users-return-263745-archive-asf-public=cust-asf.ponee.io@tomcat.apache.org Fri Feb 2 15:33:36 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id C120E180608 for ; Fri, 2 Feb 2018 15:33:36 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id B0D82160C49; Fri, 2 Feb 2018 14:33:36 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0437B160C41 for ; Fri, 2 Feb 2018 15:33:35 +0100 (CET) Received: (qmail 65375 invoked by uid 500); 2 Feb 2018 14:33:34 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 65364 invoked by uid 99); 2 Feb 2018 14:33:34 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Feb 2018 14:33:34 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id C859B1A6B70 for ; Fri, 2 Feb 2018 14:33:33 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.999 X-Spam-Level: X-Spam-Status: No, score=0.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, SPF_HELO_PASS=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 3YW743526QS6 for ; Fri, 2 Feb 2018 14:33:31 +0000 (UTC) Received: from mailbox.servedge.com (li1281-212.members.linode.com [45.79.182.212]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id A6FEA5F1EE for ; Fri, 2 Feb 2018 14:33:30 +0000 (UTC) Received: (qmail 4667 invoked by uid 513); 2 Feb 2018 08:33:29 -0600 Received: from pool-173-66-117-24.washdc.fios.verizon.net (HELO Christophers-iMac.local) (chris@christopherschultz.net@173.66.117.24) by mailbox.servedge.com with ECDHE-RSA-AES128-GCM-SHA256 encrypted SMTP; 2 Feb 2018 08:33:29 -0600 Subject: Re: xxxxx have started a thread named but has failed to stop it. To: users@tomcat.apache.org References: From: Christopher Schultz Message-ID: <56e7043e-922e-bac3-a064-f476d8ebd30d@christopherschultz.net> Date: Fri, 2 Feb 2018 09:33:29 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Carlo, On 2/2/18 8:24 AM, Luib-Finetti, Carlo wrote: > Under Windows 10, my local development Tomcat Version 8.5.11 > reports a lot of warnings about not stopped threads. For example: " > The web application [webdms-jadice] appears to have started a > thread named [pool-1-thread-1-Logging Task Scheduler] but has > failed to stop it." Our application support team reports the same > issues running Tomcat within Linux. The threads reported in the > log list various sources starting the threads: from libraries we > use, and from Tomcat's own threads like "Timer-x", "Session pool > worker", "Level-2 Pool Sweeper", " InactivityMonitor ReadCheck". None of those threads are "Tomcat's own". "Timer-x" is usually some application/library use of java.util.Timer/java.util.TimerTask. I don't recognize any of those other thread names. Do a thread dump to find out what those threads are doing when your application is running, and I'd be shocked to see Tomcat at the bottom of the stack. > Shutting down means: pressing CTRL-C in Windows or sending a kill > signal in Linux. Maybe it is not unimported that our application > itself uses an Executor Service Thread pool, which - at > contextDestroyed-event - tries to shutdown the pool with a timeout > value of 5 minutes (which is too long, I know). The log warnings > with "Thread not stopped" messages will be written to the log after > this timout. Then Tomcat effectively shuts down. 5 minutes is a long time. You might want to check to see why you ave to wait that amount of time and adjust whatever processes so that they can be interrupted if you need to take-down the server. > My question therefore is: What can we do to shutdown Tomcat in a > proper manner, that is: stopping all threads from thread pools? Can > this be managed by configuration or must this be done > programmatically? You need to identify all of the threads that are running and arrange to shut them all down. Most libraries have "shutdown" mechanisms that you can use which should clean all of this up. Typically, you have to run these "shutdown" processes in one or more ServletContextListener objects registered with the application/container. If you have a library which is starting threads that don't stop: 1. Upgrade to the latest version if possible 2. Read the documentation for how to shutdown those threads (or join the community for that library and ask) 3. Write a ServletContextListener that cleans-up that library (or, maybe there is already one bundled with the library) 4. If a "shutdown" process is not available for the library: a. Request such a process from the vendor/community or b. Find a better-designed library and use that instead Hope that helps, - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlp0drgdHGNocmlzQGNo cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFhyDw//RKkPkjs6tEdCwgaH 9ONQadWz2XLUY1uMyBD3OtfsEjqhg/96XjibQH13bBt7dC9kx9TcdnscJImCzn/u hPOavsNtxKhtpmiuwnBEISD+vH8eOh+05vXxQNqQObe8tNMS2RXG8Qnr1zl2Iu/Z U3vA1tWuEPulGeTVhPOmlWPJcA9b7lGvUpKTUH+ekdHQxq7t9glm1Om1WMZzj48P 3IPNxwe+oGVo3Ccwoe+UfmELMdPCHUbNiBnlof3bINyy+1Ucg3tssTgVet55w5JQ 9ItLc8t0FzIUAp/rDCqgzjWbFnhaw5udfLOCXS/4Ohx2v4lHq1MPO9iMepAh+z0/ HgHyywuawI+b5ULelzuSMkRHkBP7ISh5qs8Nk3dXGVo58r80ArR+iuLNK8EccrNT ilIKncOW9Xoe/Y0VRmSHi+TsWSAq8FM5fe3cnzq7/g5MK5Ah6ktnD70sDMDfRN3x 06VxH6o69W0NKaIorB4dcDrVL2z2ZiJPOfKzNEuG2dkMEwot3IvBVo4PaRyNlda3 fA5+pF4t9MbMJVDf9JU+LaTubUA694Y5TYpRYs9Hc/rygZ7wcb4U50eg4s/u4IrG SJxuMFmD65i7cZfk/m5SBTVgxhk+mRdSKXxjatDTBVSbuV1vzXU87kXcXNLu7ee+ EloBmY0axJgpLoRfxA+Wk8zpocM= =LFFJ -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org