From: Evgeniy Polyakov <zbr@ioremap.net>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Ben Greear <greearb@candelatech.com>,
David Miller <davem@davemloft.net>,
Gaspar Chilingarov <gasparch@gmail.com>,
netdev <netdev@vger.kernel.org>
Subject: Re: PROBLEM: Linux kernel 2.6.31 IPv4 TCP fails to open huge amount of outgoing connections (unable to bind ... )
Date: Wed, 21 Apr 2010 13:58:12 +0400 [thread overview]
Message-ID: <20100421095812.GA14778@ioremap.net> (raw)
In-Reply-To: <1271840535.7895.1612.camel@edumazet-laptop>
On Wed, Apr 21, 2010 at 11:02:15AM +0200, Eric Dumazet (eric.dumazet@gmail.com) wrote:
> Le mercredi 21 avril 2010 à 12:25 +0400, Evgeniy Polyakov a écrit :
>
> > I believe this is a useful patch, but it addresses a different issue.
> > This path should not fire up when we bind to single address.
>
> Well, the real problem is that following sequence can happen :
>
> socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 5
> setsockopt(5, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
> bind(5, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.2")}, 16) = 0
> getsockname(5, {sa_family=AF_INET, sin_port=htons(34000), sin_addr=inet_addr("127.0.0.2")}, [16]) = 0
> socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 6
> setsockopt(6, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
> bind(6, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.2")}, 16) = 0
> getsockname(6, {sa_family=AF_INET, sin_port=htons(34002), sin_addr=inet_addr("127.0.0.2")}, [16]) = 0
> socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 7
> setsockopt(7, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
> bind(7, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.2")}, 16) = 0
> getsockname(7, {sa_family=AF_INET, sin_port=htons(34001), sin_addr=inet_addr("127.0.0.2")}, [16]) = 0
> socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 8
> setsockopt(8, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
> bind(8, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.2")}, 16) = 0
> getsockname(8, {sa_family=AF_INET, sin_port=htons(34002), sin_addr=inet_addr("127.0.0.2")}, [16]) = 0
> socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 9
> setsockopt(9, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
> bind(9, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.2")}, 16) = 0
> getsockname(9, {sa_family=AF_INET, sin_port=htons(34000), sin_addr=inet_addr("127.0.0.2")}, [16]) = 0
> socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 10
> setsockopt(10, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
> bind(10, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.2")}, 16) = 0
> getsockname(10, {sa_family=AF_INET, sin_port=htons(34002), sin_addr=inet_addr("127.0.0.2")}, [16]) = 0
> socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 11
> setsockopt(11, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
> bind(11, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.2")}, 16) = 0
> getsockname(11, {sa_family=AF_INET, sin_port=htons(34001), sin_addr=inet_addr("127.0.0.2")}, [16]) = 0
>
>
> Note ports are given several times for different sockets.
>
> So several sockets are 'bound' to same IP:port values
That's kind of weird, since address is the same. I'm curious why bind
conflict does not resolve that. Likely because socket is not yet
connected.
> At connect() time, we refuse and say address is not available.
Yup. But isn't it a different problem from what Gaspar observed?
Netcat connects after bind so it should not be an issue here.
--
Evgeniy Polyakov
next prev parent reply other threads:[~2010-04-21 9:58 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-20 22:17 PROBLEM: Linux kernel 2.6.31 IPv4 TCP fails to open huge amount of outgoing connections (unable to bind ... ) Gaspar Chilingarov
2010-04-20 22:31 ` Eric Dumazet
2010-04-20 23:18 ` Gaspar Chilingarov
2010-04-20 23:42 ` Eric Dumazet
2010-04-21 0:14 ` Evgeniy Polyakov
2010-04-20 23:07 ` Ben Greear
2010-04-20 23:20 ` Gaspar Chilingarov
2010-04-20 23:20 ` Gaspar Chilingarov
2010-04-20 23:30 ` Ben Greear
2010-04-20 23:35 ` Gaspar Chilingarov
2010-04-20 23:49 ` Ben Greear
2010-04-20 23:57 ` Gaspar Chilingarov
2010-04-21 0:14 ` Eric Dumazet
2010-04-21 0:05 ` Eric Dumazet
2010-04-21 0:12 ` Gaspar Chilingarov
2010-04-21 0:14 ` David Miller
2010-04-21 0:30 ` Evgeniy Polyakov
2010-04-21 2:04 ` David Miller
2010-04-21 5:46 ` Eric Dumazet
2010-04-21 8:25 ` Evgeniy Polyakov
2010-04-21 9:02 ` Eric Dumazet
2010-04-21 9:58 ` Evgeniy Polyakov [this message]
2010-04-21 10:21 ` Eric Dumazet
2010-04-21 11:27 ` Eric Dumazet
2010-04-21 16:52 ` George B.
2010-04-21 18:27 ` Evgeniy Polyakov
2010-04-21 18:43 ` Eric Dumazet
2010-04-21 18:58 ` Evgeniy Polyakov
2010-04-21 19:26 ` Eric Dumazet
2010-04-21 20:08 ` Evgeniy Polyakov
2010-04-23 2:06 ` David Miller
2010-04-25 14:26 ` Michael S. Tsirkin
2010-04-25 15:56 ` Evgeniy Polyakov
2010-04-25 16:13 ` Eric Dumazet
2010-04-25 16:21 ` Eric Dumazet
2010-04-25 16:35 ` Michael S. Tsirkin
2010-04-25 22:08 ` David Miller
2010-04-21 19:03 ` Narendra Choyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100421095812.GA14778@ioremap.net \
--to=zbr@ioremap.net \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=gasparch@gmail.com \
--cc=greearb@candelatech.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.