Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 32FA21803A for ; Fri, 5 Feb 2016 22:47:53 +0000 (UTC) Received: (qmail 34811 invoked by uid 500); 5 Feb 2016 22:47:49 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 34750 invoked by uid 500); 5 Feb 2016 22:47:49 -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 34739 invoked by uid 99); 5 Feb 2016 22:47:49 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Feb 2016 22:47:49 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 01462C02A8 for ; Fri, 5 Feb 2016 22:47:49 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.3 X-Spam-Level: X-Spam-Status: No, score=0.3 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id S8_E4OwtLbtP for ; Fri, 5 Feb 2016 22:47:47 +0000 (UTC) Received: from vms173023pub.verizon.net (vms173023pub.verizon.net [206.46.173.23]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id AAFEF31AA9 for ; Fri, 5 Feb 2016 22:47:46 +0000 (UTC) Received: from Christophers-iMac.local ([71.127.40.115]) by vms173023.mailsrvcs.net (Oracle Communications Messaging Server 7.0.5.32.0 64bit (built Jul 16 2014)) with ESMTPA id <0O2300L21JB63760@vms173023.mailsrvcs.net> for users@tomcat.apache.org; Fri, 05 Feb 2016 16:47:30 -0600 (CST) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=MtGvkDue c=1 sm=1 tr=0 a=tVXBnewmVzifmTgg5+7jYA==:117 a=IkcTkHD0fZMA:10 a=jFJIQSaiL_oA:10 a=Sor4rNYxAAAA:8 a=COfzQ7OkAAAA:8 a=j4nzMFrpAAAA:8 a=QfKxxUxMAAAA:8 a=t6yfiy7rs0DgIjZBAhEA:9 a=QEXdDO2ut3YA:10 a=4vOJFGA7r4AA:10 a=-FEs8UIgK8oA:10 a=NWVoK91CQyQA:10 Subject: Re: Tomcat 6 | Tomcat with APR causing Thread Blocking To: Tomcat Users List References: <7F63039D2218A248A3A59670233302034E3FD5F0@LTCFISWMSGMB11.FNFIS.com> From: Christopher Schultz X-Enigmail-Draft-Status: N1110 Message-id: <56B52682.8070602@christopherschultz.net> Date: Fri, 05 Feb 2016 17:47:30 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-version: 1.0 In-reply-to: <7F63039D2218A248A3A59670233302034E3FD5F0@LTCFISWMSGMB11.FNFIS.com> Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 8bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ravi, On 2/4/16 2:15 AM, Ranjan, Ravi wrote: > I am new to this user list and this is the first email I am > sending out to you. Hope you will let me know if more > information/logs/dump/test case/clarity is required. Welcome. > So I am working with Tomcat 6.0.41 (both 64bit and 32 bit). In my > Tomcat environment I am using APR (Apache Portable > Runtime)Listener: (by configuring > below property in server.xml) className="org.apache.catalina.core.AprLifecycleListener" > SSLEngine="on" /> So far, so good. The only think you didn't mention was the versions of APR and tcnative you were using, and your OS. > I am using below connector, which i assume is a blocking type: > connectionTimeout="20000" redirectPort="8443" /> If you have APR available, then that configuration will give you the APR connector. If APR is not available, you'll get the Java BIO (blocking I/O) connector. > In one of my webapp i am running a dll as a Java Process to > validate some data. This dll is accessed as a Process whenever is > required. I have separate Thread to terminate this Process if not > used for few minutes. (DLL: So this is Microsoft Windows?) > Now i am facing a weired issue where with Apache Tomcat 6.0.43 > (both 64 and 32 bit), the http thread that has started this process > gets stuck. From thread dump i get this stack trace: > > "http-8080-2" - Thread t@55 java.lang.Thread.State: RUNNABLE at > java.net.SocketInputStream.socketRead0(Native Method) at > java.net.SocketInputStream.read(SocketInputStream.java:152) at > java.net.SocketInputStream.read(SocketInputStream.java:122) at > java.io.BufferedInputStream.fill(BufferedInputStream.java:235) at > java.io.BufferedInputStream.read(BufferedInputStream.java:254) - > locked <1559b4d1> (a java.io.BufferedInputStream) at > org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:7 7) > > at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105 ) > at > org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.j ava:1118) > > . > . . Hmm. The thread name doesn't say what type of connector it is. I might just be used to seeing thread names from Tomcat 7+, where it's clear whether nio/bio/apr is in use. But! The stack trace above is not Tomcat's code. This is your code calling-out through commons HttpClient to another server. None of your configuration has any bearing on how that connection is handled. > To ascertain that the native process is not causing the issue, i > ran few other external exe's (both 64 bit and 32 bit) with same > result. > > During my research i found that if i comment the above listed > AprLifecycleListener property from the server.xml, things start > working. This behavior is very inconsistent across different > versions of Tomcat, e.g. in Tomcat 6.0.10, i am not facing the > issue. Then i upgraded to Tomcat 8, i faced this issue. I have > tried with many versions of Tomcat and all result in same > behavior. > > So, is this APR interfering with my own process calls? Or is there > something that i am missing. Anyone who have seen any such tomcat > bugs or fixes can point me as well. I'm not convinced this has anything to do with Tomcat at all, actually. If your code is stuck calling another service, there's nothing Tomcat can do about it. Can you show us more of that stack trace? Something many programmers forget is that any time you are making a call that touches the network, it's vitally important to set appropriate timeouts. Many APIs default to "no timeout: wait forever" which means if there's some kind of network lag or whatever, your web application will become unresponsive if you make requests to some other unreliable service. If you timeout after 2-3 seconds, at least your application can tell the user "sorry, that *other* service is down", instead of locking everything up. Hope that helps, - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAla1JoIACgkQ9CaO5/Lv0PDEqACguX5Mi+XmVMKj1+C7K4hy6rQv I+QAn0qnJm+82GiA0F5kdPesL5THEAAo =J4DD -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org