Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@www.apache.org Received: (qmail 25712 invoked from network); 13 Jul 2004 10:24:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 13 Jul 2004 10:24:17 -0000 Received: (qmail 29424 invoked by uid 500); 13 Jul 2004 10:24:07 -0000 Delivered-To: apmail-jakarta-tomcat-dev-archive@jakarta.apache.org Received: (qmail 29307 invoked by uid 500); 13 Jul 2004 10:24:05 -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 29292 invoked by uid 99); 13 Jul 2004 10:24:05 -0000 X-ASF-Spam-Status: No, hits=-0.1 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Tue, 13 Jul 2004 03:24:05 -0700 Received: (qmail 25603 invoked from network); 13 Jul 2004 10:24:04 -0000 Received: from localhost.hyperreal.org (HELO ?172.31.1.164?) (127.0.0.1) by localhost.hyperreal.org with SMTP; 13 Jul 2004 10:24:04 -0000 Message-ID: <40F3B7C0.5040106@apache.org> Date: Tue, 13 Jul 2004 12:21:52 +0200 From: Henri Gomez User-Agent: Mozilla Thunderbird 0.7.1 (Windows/20040626) X-Accept-Language: en-us, en 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> In-Reply-To: <40F38A5C.7010908@fujitsu-siemens.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: localhost.hyperreal.org 1.6.2 0/1000/N X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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 ? Patch welcome --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org