-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
repeated socket()/close() runs out of sockets #2414
Comments
Also checked LWIP_SO_REUSE is set so it should not be waiting |
I think this is the same problem as #2403. |
Hi Richard, Running the http-request example with default configuration and specified IDF version caused no socket exhaustion. Could you please confirm that return value of
Thank you, |
I have just gone back to my project to check on the close() return and am unable to build it anymore as make makeconfig fails with make: *** No rule to make target 'makeconfig'. Stop. |
OK, added code to print return value of close I (138750) example: ... Last close socket return value=0 After Socket Handle 4105 it fails About to try the proposed fix |
Commit ID:eea49d250 seems to fix the issue with the sockets not being freed on close. |
@rleinfellner This probelm has been solved in the commit:a5533a0. You can close this issue. |
Environment
git rev-parse --short HEAD
to get the commit id.): 405b198Problem Description
//Detailed problem description goes here.
http_request example, issue with repeated socket()/close()
After a number of cycles, no more sockets are available
It looks like close() is not marking the socket as reuseable
Expected Behavior
you should be able to open()/close(0 sockets as many time as you like
Actual Behavior
After 10 socket()/close() cycles the system runs out of sockets
Steps to reproduce
Compile and run standard http-request example
After 10 cycles the system runs out of sockets
Debug log, note the code has been modified to print the socket handle, this starts at 4096 and increments to 4105 before no more sockets are availiable
Test = 100
I (138849) example: ... done reading from socket. Last read return=-1 errno=11
I (138849) example: 10...
I (139849) example: 9...
I (140849) example: 8...
I (141849) example: 7...
I (142849) example: 6...
I (143849) example: 5...
I (144849) example: 4...
I (145849) example: 3...
I (146849) example: 2...
I (147849) example: 1...
I (148849) example: 0...
I (149849) example: Starting again!
I (149849) example: Connected to AP
I (149849) example: DNS lookup succeeded. IP=192.64.118.69
I (149849) example: ... allocated socket 4105
I (150049) example: ... connected
I (150049) example: ... socket send success
I (150049) example: ... set socket receiving timeout success
HTTP/1.1 200 OK
Date: Sun, 16 Sep 2018 11:23:44 GMT
Server: Apache
Last-Modified: Sun, 16 Sep 2018 10:46:31 GMT
Accept-Ranges: bytes
Content-Length: 11
Keep-Alive: timeout=3, max=200
Connection: close
Test = 100
I (155259) example: ... done reading from socket. Last read return=-1 errno=11
I (155259) example: 10...
I (156259) example: 9...
I (157259) example: 8...
I (158259) example: 7...
I (159259) example: 6...
I (160259) example: 5...
I (161259) example: 4...
I (162259) example: 3...
I (163259) example: 2...
I (164259) example: 1...
I (165259) example: 0...
I (166259) example: Starting again!
I (166259) example: Connected to AP
I (166259) example: DNS lookup succeeded. IP=192.64.118.69
E (166259) example: ... Failed to allocate socket.
The text was updated successfully, but these errors were encountered: