Date: Fri, 18 Feb 2005 17:43:23 +0300 From: Deomid Ryabkov <myself@rojer.pp.ru> To: Peter Edwards <peadar.edwards@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: occasional ECONNREFUSED when connect()ing. Message-ID: <4215FF0B.6060307@rojer.pp.ru> In-Reply-To: <34cb7c8405021806386fb874ee@mail.gmail.com> References: <4215EB31.8020107@rojer.pp.ru> <34cb7c8405021806386fb874ee@mail.gmail.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
guys, there is _source_ of the server at the end of my post!
there are no threads nor forks and backlog is set to 511 (Apache's
default value).
and client always waits for rrequst to complete before sending a new one.
Peter Edwards wrote:
>On Fri, 18 Feb 2005 16:18:41 +0300, Deomid Ryabkov <myself@rojer.pp.ru> wrote:
>
>
>>I have a strange case of occasional refused connect()'s.
>>The system is running 4.10-STABLE.
>>
>>This was originally reported by one of our developers.
>>The test script he provided is a simple Perl script that repeatedly
>>fetches an URL
>>from Apache running on this same server.
>>In the run of 2000 iterations, there are 5-10 random errors fetching the
>>URL.
>>After further investigation and digging, I uncovered the true cause of
>>the error:
>>connect() returning ECONNREFUSED.
>>To see if this was somehow related to Apache, I wrote my own simple
>>server that
>>accept()'s a connection, read()'s what supposed to be request and
>>write()'s a stereotypic reply,
>>thus resembling an HTTP request/reply conversation.
>>The number of sporadically occuring connect() errors has increased somewhat,
>>maybe due to quicker turnaround of my stub-server.
>>The question is - why do connections get refused at all?
>>I can think of no valid reasons...
>>
>>
>
>Here's one:
>In your stub server, what do you set the backlog to in the call to listen(2)?
>
>By the time you get the file descriptor for the new call from
>accept(), the kernel has already established the TCP/IP connection,
>and is maintaining state (ie, using resources) for it
>
>If you take a while dealing with this new call, (starting a thread,
>forking, or even processing the connection), then by the time you
>invoke accept() again, any number of clients may have attempted to
>connect to you, and the kernel needs to maintain state for every
>connection that has been requested.
>
>The backlog on the listen call indicates how many of these connections
>the kernel should hold on to: If the number of unaccept()ed
>connections reaches the backlog, you'll start to get ECONREFUSED
>errors at the client. If your stub server is single-threaded, this'll
>be pretty much guaranteed to happen if the number of clients exceeds
>the backlog on ths server's listening socket.
>
>HTH,
>peadar.
>
--
Deomid Ryabkov aka Rojer
myself@rojer.pp.ru
rojer@sysadmins.ru
ICQ: 8025844
[-- Attachment #2 --]
0 *H
010 + 0 *H
#00U
v0
*H
0b10 UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA0
040331221809Z
050331221809Z0_10URyabkov10
U*Deomid10UDeomid Ryabkov1!0 *H
myself@rojer.pp.ru0"0
*H
0
x?ed:4y h"0$F;O 4{7kU-)A
{ ;qrk,6s+ZȀ&Qvi)ZRu%0 @<r\=/)NK4풓d|$_&aNq!ڨ66.ʺ`WPFmd;,H,ؑPd0!J5Sـd PIK3@]42g
\i3 /0-0U0myself@rojer.pp.ru0U0 0
*H
+~4YXf
DW?%\;҇B2n
Ϸ|Jճ2++fZ7[m~X㽀c6x*2%^LnmoUkQ|Z>?X\uɝp/:00U
v0
*H
0b10 UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA0
040331221809Z
050331221809Z0_10URyabkov10
U*Deomid10UDeomid Ryabkov1!0 *H
myself@rojer.pp.ru0"0
*H
0
x?ed:4y h"0$F;O 4{7kU-)A
{ ;qrk,6s+ZȀ&Qvi)ZRu%0 @<r\=/)NK4풓d|$_&aNq!ڨ66.ʺ`WPFmd;,H,ؑPd0!J5Sـd PIK3@]42g
\i3 /0-0U0myself@rojer.pp.ru0U0 0
*H
+~4YXf
DW?%\;҇B2n
Ϸ|Jճ2++fZ7[m~X㽀c6x*2%^LnmoUkQ|Z>?X\uɝp/:0?0
0
*H
010 UZA10UWestern Cape10U Cape Town10U
Thawte Consulting1(0&UCertification Services Division1$0"UThawte Personal Freemail CA1+0) *H
personal-freemail@thawte.com0
030717000000Z
130716235959Z0b10 UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA00
*H
0 Ħ<UsUNʙZhup[v:aQP
0cZ,p+Z?qV˯<6$*+w=+>@dקe*TH<a@dr` 00U0 0CU<0:08642http://crl.thawte.com/ThawtePersonalFreemailCA.crl0U0)U"0 010UPrivateLabel2-1380
*H
HP.
fgCL!6-6/P p<ab:~ t%Pb'qW%ݩ9 Oe_N4[5MwV!x!5$F]_eO1;070i0b10 UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA
v0 + 0 *H
1 *H
0 *H
1
050218144323Z0# *H
1]|})$~K)0R *H
1E0C0
*H
0*H
0
*H
@0+0
*H
(0x +71k0i0b10 UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA
v0z*H
1ki0b10 UZA1%0#U
Thawte Consulting (Pty) Ltd.1,0*U#Thawte Personal Freemail Issuing CA
v0
*H
04_~+mt;~_v?6U*ʋh`'0`!UhQ)gɒH9kuuFiDP_
xck^ Ԅ
\_4wLĶ?RyYNg6t@0aO0p2pwu,R[poQ8#7,gX]jH}A|m:?K8N_S9aȀp J\iU$,
p:Gx2d<U'z
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4215FF0B.6060307>
