On 05/04/2019 01:17, Chris Johns wrote:
On 5/4/19 4:53 am, Matthew J Fletcher wrote:
Hi Sebastian

I used rtems_task_wake_after().


On Thu, 4 Apr 2019, 18:22 Sebastian Huber, <sebastian.hu...@embedded-brains.de
<mailto:sebastian.hu...@embedded-brains.de>> wrote:

     How do you wait. Is this a busy wait?

     ----- Matthew J Fletcher <ami...@gmail.com <mailto:ami...@gmail.com>> 
schrieb:
     > replying to myself.
     >
     > With a 1 second pause between socket() and close() and 512 sockets it 
will
     > still ENOBUFS,.. without calculating it properly thats easily 10 minutes
     > since the first socket was allocated,. that must be enough time to start
     > freeing the socket buffers internally.
     >
     >
     > On Thu, 4 Apr 2019 at 16:47, Matthew J Fletcher <ami...@gmail.com
     <mailto:ami...@gmail.com>> wrote:
     >
     > > Hi,
     > >
     > > I have noticed an issue with lib-bsd that the legacy stack does not 
have.
     > >
     > > If have a loop that does
     > >
     > > for (;;)
     > > {
     > >   wait(100) // milliseconds
     > >   socket() // allocate
     > >   close() // free
     > > }
Are you able to make a small stand alone test?

Yes, a self contained test case would be helpful. I cannot reproduce the issue with the modified test case in attached patch for libbsd.

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

>From dcefc9d70b689bb62b5ba729439867dc2083d902 Mon Sep 17 00:00:00 2001
From: Sebastian Huber <sebastian.hu...@embedded-brains.de>
Date: Fri, 5 Apr 2019 08:57:28 +0200
Subject: [PATCH] syscalls01: Add infinite socket()/close() test

---
 testsuite/syscalls01/test_main.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/testsuite/syscalls01/test_main.c b/testsuite/syscalls01/test_main.c
index 6943cd1a4..fc654b478 100644
--- a/testsuite/syscalls01/test_main.c
+++ b/testsuite/syscalls01/test_main.c
@@ -343,6 +343,22 @@ test_sockets(void)
 
 	puts("test sockets");
 
+	int c = 0;
+	while (true) {
+		int s = socket(PF_INET, SOCK_STREAM, 0);
+		assert(s >= 0);
+
+		int rv = close(s);
+		assert(rv == 0);
+
+		rtems_task_wake_after(1);
+
+		++c;
+		if (c % 1000 == 0) {
+			printf("%i\n", c);
+		}
+	}
+
 	for (i = 0; i < n; ++i) {
 		const socket_test *st = &socket_tests[i];
 
@@ -1647,4 +1663,6 @@ test_main(void)
 	exit(0);
 }
 
+#define CONFIGURE_MICROSECONDS_PER_TICK 1000
+
 #include <rtems/bsd/test/default-init.h>
-- 
2.16.4

_______________________________________________
users mailing list
users@rtems.org
http://lists.rtems.org/mailman/listinfo/users

Reply via email to