public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Problem when lots of sockets open.
@ 2001-03-08 17:28 Grant Edwards
  2001-03-09  5:30 ` Lewin A.R.W. Edwards
  2001-03-12  8:22 ` Grant Edwards
  0 siblings, 2 replies; 7+ messages in thread
From: Grant Edwards @ 2001-03-08 17:28 UTC (permalink / raw)
  To: ecos-discuss

I've got an eCos app that listens for TCP connections on 16
different ports.  

I can connect to any 8 of them, but usually the 9th TCP
connection opens and is then immediately closed by the eCos
stack: the eCos system sends a FIN exactly 50ms after the 2nd
SYN is ack'ed.  I've added some diag_printfs to figure out
where the socket is getting closed, and pretty sure it's not me
calling close().

I've also seen situations where there are 8 open sockets, and
the 9th connect succeeds but kills one of 8 previously open
sockets.

I did have to increase the number of open files allowed from 16
to 32. Since I never get to socket 31, I don't think that's the
problem this time.

Is there another limit somewhere I need to increase to get more
than 8 open TCP connections?  I don't see anything in ecos.ecc
that looks like a limit on TCP connections.

-- 
Grant Edwards
grante@visi.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Problem when lots of sockets open.
  2001-03-08 17:28 [ECOS] Problem when lots of sockets open Grant Edwards
@ 2001-03-09  5:30 ` Lewin A.R.W. Edwards
  2001-03-09  7:13   ` Grant Edwards
  2001-03-12  8:22 ` Grant Edwards
  1 sibling, 1 reply; 7+ messages in thread
From: Lewin A.R.W. Edwards @ 2001-03-09  5:30 UTC (permalink / raw)
  To: Grant Edwards, ecos-discuss

>I can connect to any 8 of them, but usually the 9th TCP
>connection opens and is then immediately closed by the eCos
>stack: the eCos system sends a FIN exactly 50ms after the 2nd

Dumb question maybe (I am not a networking guy)... but are you running out 
of memory?

=== Lewin A.R.W. Edwards (Embedded Engineer)
Work: http://www.digi-frame.com/
Personal: http://www.zws.com/ and http://www.larwe.com/

"Und setzet ihr nicht das Leben ein,
Nie wird euch das Leben gewonnen sein."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Problem when lots of sockets open.
  2001-03-09  5:30 ` Lewin A.R.W. Edwards
@ 2001-03-09  7:13   ` Grant Edwards
  0 siblings, 0 replies; 7+ messages in thread
From: Grant Edwards @ 2001-03-09  7:13 UTC (permalink / raw)
  To: Lewin A.R.W. Edwards; +Cc: ecos-discuss

On Thu, Mar 08, 2001 at 08:46:19PM -0500, Lewin A.R.W. Edwards wrote:
> 
> >I can connect to any 8 of them, but usually the 9th TCP
> >connection opens and is then immediately closed by the eCos
> >stack: the eCos system sends a FIN exactly 50ms after the 2nd
> 
> Dumb question maybe (I am not a networking guy)... but are you running out 
> of memory?

I don't think so.  I was getting out of MBUF warnings with 256K
of buffer space.  I doubled it to 512K. That's when I ran into
th 8 TCP connection limit.  I doubled it again to 1M no change
-- still can't open a 9th TCP connection.

-- 
Grant Edwards
grante@visi.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Problem when lots of sockets open.
  2001-03-08 17:28 [ECOS] Problem when lots of sockets open Grant Edwards
  2001-03-09  5:30 ` Lewin A.R.W. Edwards
@ 2001-03-12  8:22 ` Grant Edwards
  2001-03-12 10:42   ` Grant Edwards
  1 sibling, 1 reply; 7+ messages in thread
From: Grant Edwards @ 2001-03-12  8:22 UTC (permalink / raw)
  To: ecos-discuss

On Thu, Mar 08, 2001 at 07:33:12PM -0600, Grant Edwards wrote:

> I've got an eCos app that listens for TCP connections on 16
> different ports.  
> 
> I can connect to any 8 of them, but usually the 9th TCP
> connection opens and is then immediately closed by the eCos
> stack: the eCos system sends a FIN exactly 50ms after the 2nd
> SYN is ack'ed.  I've added some diag_printfs to figure out
> where the socket is getting closed, and pretty sure it's not me
> calling close().

FYI: I've built a stripped down app that successfully accepts
connections on 16 TCP ports simultaneously, so it appears to be
an application bug.

-- 
Grant Edwards
grante@visi.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Problem when lots of sockets open.
  2001-03-12  8:22 ` Grant Edwards
@ 2001-03-12 10:42   ` Grant Edwards
  2001-03-12 12:27     ` Gary Thomas
  0 siblings, 1 reply; 7+ messages in thread
From: Grant Edwards @ 2001-03-12 10:42 UTC (permalink / raw)
  To: ecos-discuss

On Mon, Mar 12, 2001 at 10:27:19AM -0600, Grant Edwards wrote:

> FYI: I've built a stripped down app that successfully accepts
> connections on 16 TCP ports simultaneously, so it appears to be
> an application bug.

I can duplicate the failure in my stripped down demo
application: If there's a single task that uses select to
monitor the listening sockets and the echo data on the
connected data sockets, it works fine.

If I create separate tasks to echo data on each connected
socket, the 9th connection fails. A read() on the socket
returns -1 immediately with errno==360 (operation timed out).

Has anybody seen behavior like this?

-- 
Grant Edwards
grante@visi.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Problem when lots of sockets open.
  2001-03-12 10:42   ` Grant Edwards
@ 2001-03-12 12:27     ` Gary Thomas
  2001-03-12 12:35       ` Grant Edwards
  0 siblings, 1 reply; 7+ messages in thread
From: Gary Thomas @ 2001-03-12 12:27 UTC (permalink / raw)
  To: Grant Edwards; +Cc: ecos-discuss

On 12-Mar-2001 Grant Edwards wrote:
> On Mon, Mar 12, 2001 at 10:27:19AM -0600, Grant Edwards wrote:
> 
>> FYI: I've built a stripped down app that successfully accepts
>> connections on 16 TCP ports simultaneously, so it appears to be
>> an application bug.
> 
> I can duplicate the failure in my stripped down demo
> application: If there's a single task that uses select to
> monitor the listening sockets and the echo data on the
> connected data sockets, it works fine.
> 
> If I create separate tasks to echo data on each connected
> socket, the 9th connection fails. A read() on the socket
> returns -1 immediately with errno==360 (operation timed out).
> 
> Has anybody seen behavior like this?

No.  Can you provide the test case?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] Problem when lots of sockets open.
  2001-03-12 12:27     ` Gary Thomas
@ 2001-03-12 12:35       ` Grant Edwards
  0 siblings, 0 replies; 7+ messages in thread
From: Grant Edwards @ 2001-03-12 12:35 UTC (permalink / raw)
  To: Gary Thomas; +Cc: ecos-discuss

On Mon, Mar 12, 2001 at 01:27:03PM -0700, Gary Thomas wrote:

> >> FYI: I've built a stripped down app that successfully accepts
> >> connections on 16 TCP ports simultaneously, so it appears to be
> >> an application bug.
> > 
> > I can duplicate the failure in my stripped down demo
> > application: If there's a single task that uses select to
> > monitor the listening sockets and the echo data on the
> > connected data sockets, it works fine.
> > 
> > If I create separate tasks to echo data on each connected
> > socket, the 9th connection fails. A read() on the socket
> > returns -1 immediately with errno==360 (operation timed out).
> > 
> > Has anybody seen behavior like this?
> 
> No.  Can you provide the test case?

I just figured out the problem. 

CYGPKG_NET_NUM_WAKEUP_EVENTS controls the max number of pending
(blocked) network operations, and it defaults to 8.  

When you try to perform the 9th blocking operation, you run out
of wakup events and you get an ETIMEDOUT error.  Despite my
earlier claim that I wasn't closing the sockets, it was my task
that was closing the socket when it got the error return from
read().

Once I figured out I was getting a ETIMEDOUT error, it was
pretty easy to grep through the net sources and find what was
causing it.

-- 
Grant Edwards
grante@visi.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-03-12 12:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-08 17:28 [ECOS] Problem when lots of sockets open Grant Edwards
2001-03-09  5:30 ` Lewin A.R.W. Edwards
2001-03-09  7:13   ` Grant Edwards
2001-03-12  8:22 ` Grant Edwards
2001-03-12 10:42   ` Grant Edwards
2001-03-12 12:27     ` Gary Thomas
2001-03-12 12:35       ` Grant Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).