Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@www.apache.org Received: (qmail 55498 invoked from network); 13 Jul 2004 11:19:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 13 Jul 2004 11:19:49 -0000 Received: (qmail 99283 invoked by uid 500); 13 Jul 2004 11:19:40 -0000 Delivered-To: apmail-jakarta-tomcat-dev-archive@jakarta.apache.org Received: (qmail 99208 invoked by uid 500); 13 Jul 2004 11:19:39 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 99193 invoked by uid 99); 13 Jul 2004 11:19:39 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received: from [217.115.66.9] (HELO plam.fujitsu-siemens.com) (217.115.66.9) by apache.org (qpsmtpd/0.27.1) with ESMTP; Tue, 13 Jul 2004 04:19:36 -0700 Received: from trolli.pdb.fsc.net ([172.25.96.53]) by plam.fujitsu-siemens.com (8.11.3/8.11.3) with ESMTP id i6DBJYx27958 for ; Tue, 13 Jul 2004 13:19:34 +0200 Received: from deejai2.mch.fsc.net (deejai2.mch.fsc.net [172.25.124.236]) by trolli.pdb.fsc.net (8.11.6/8.11.6) with ESMTP id i6DBJYR11004 for ; Tue, 13 Jul 2004 13:19:34 +0200 Received: from fujitsu-siemens.com (ijfy8h8j7044dy6h@deejai2.mch.fsc.net [172.25.124.236]) by deejai2.mch.fsc.net (8.12.11/8.12.11) with ESMTP id i6DBG7Ac022305 for ; Tue, 13 Jul 2004 13:16:07 +0200 (CEST) (envelope-from jfrederic.clere@fujitsu-siemens.com) Message-ID: <40F3C564.5070000@fujitsu-siemens.com> Date: Tue, 13 Jul 2004 13:20:04 +0200 From: jean-frederic clere Reply-To: jfrederic.clere@fujitsu-siemens.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7b) Gecko/20040517 X-Accept-Language: en, fr, de MIME-Version: 1.0 To: Tomcat Developers List Subject: Re: jk_connect and multi-threading References: <40ED75C0.8090802@fujitsu-siemens.com> <40EEBF6E.4050904@fujitsu-siemens.com> <40F262F2.8070809@apache.org> <004f01c4683c$b0a53500$6c37a8c0@bbarkerxp> <40F37D60.2040104@apache.org> <40F38266.1080704@apache.org> <40F38A5C.7010908@fujitsu-siemens.com> <40F3B7C0.5040106@apache.org> In-Reply-To: <40F3B7C0.5040106@apache.org> X-Enigmail-Version: 0.84.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Henri Gomez wrote: > jean-frederic clere wrote: > >> Henri Gomez wrote: >> >>> Henri Gomez wrote: >>> >>>> Bill Barker wrote: >>>> >>>>> ----- Original Message ----- >>>>> From: "Henri Gomez" >>>>> To: "Tomcat Developers List" >>>>> Sent: Monday, July 12, 2004 3:07 AM >>>>> Subject: jk_connect and multi-threading >>>>> >>>>> >>>>> >>>>>> Hi to all, >>>>>> >>>>>> I'm looking for a strange problem under iSeries (AS/400) and wonder >>>>>> about this look in jk_open_socket() (jk_connect.c) : >>>>>> >>>>>> do { >>>>>> jk_log(l, JK_LOG_DEBUG, "jk_open_socket, try to connect >>>>>> socket = %d to %s\n", >>>>>> sock, jk_dump_hinfo(addr, buf)); >>>>>> >>>>>> ret = connect(sock, >>>>>> (struct sockaddr *)addr, >>>>>> sizeof(struct sockaddr_in)); >>>>>> #if defined(WIN32) || (defined(NETWARE) && defined(__NOVELL_LIBC__)) >>>>>> if(SOCKET_ERROR == ret) { >>>>>> errno = WSAGetLastError() - WSABASEERR; >>>>>> } >>>>>> #endif /* WIN32 */ >>>>>> jk_log(l, JK_LOG_DEBUG, "jk_open_socket, after connect >>>>>> ret >>>>>> = %d\n", ret); >>>>>> } while (-1 == ret && EINTR == errno); >>>>>> >>>>>> >>>>>> What's the status on errno in multi-threaded environnement ? >>>>>> >>>>> >>>>> >>>>> On older *nix boxes it wasn't safe to use it with threads. Don't >>>>> know about >>>>> iSeries. On Solaris it's per-thread (assuming that you've compiled >>>>> with -D_REENTRANT). >>>>> >>>>> >>>>>> Shouldn't we clear errno before the connect() call ? >>>>>> >>>>> >>>>> >>>>> It's not supposed to matter. >>>>> >>>>> >>>>>> BTW, I wonder why we check the errno in such case... >>>> >>>> >>>> >>>> >>>> >>>> Ok, I take a look at IBM errno list and error 3021 is for EINVAL >>>> (invalid argument). >>>> >>>> I'll investigate this error farther... >>> >>> >>> >>> >>> The problem could be related to BSD 4.4/Unix 98 where the sa_len >>> should be defined before connect call. May be one of the various >>> reason where >>> jk_connect failed strangely on many boxes. >> >> >> >> Yes, APR uses: >> +++ >> apr_status_t apr_socket_connect(apr_socket_t *sock, apr_sockaddr_t *sa) >> { >> int rc; >> >> do { >> rc = connect(sock->socketdes, >> (const struct sockaddr *)&sa->sa.sin, >> sa->salen); >> } while (rc == -1 && errno == EINTR); >> +++ >> So setting sa_len and USING sa_len instead sizeof(sockaddr_in) in the >> socket() should fix most of the problems. > > > Ok, but how could we get the correct sa_len ? That should be done in jk_resolve(). > > Patch welcome > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org