简体   繁体   中英

Too many open files Error is seen when we run robot framework test cases

I have a test suite with about 300 test cases. These test cases are HTTP API Calls. All are 'GET' API calls. The initial test cases execute fine. But towards the end of the execution, the error "error: [Errno 24] Too many open files" is thrown. This causes the test cases to fail even though we do not have any functional issue in the system under test.

How to fix this issue?

The error in the report is:

error: [Errno 24] Too many open files   
08:55:00.484    DEBUG   Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/HttpLibrary/__init__.py", line 229, in GET
self.app.get(path, {}, self.context.request_headers)

File "/Library/Python/2.7/site-packages/webtest/app.py", line 286, in get

File "/Library/Python/2.7/site-packages/HttpLibrary/livetest.py", line 153, in do_request

File "/Library/Python/2.7/site-packages/HttpLibrary/livetest.py", line 126, in _do_httplib_request

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 973, in request

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1007, in _send_request

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 969, in endheaders

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 829, in _send_output

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 791, in send

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 772, in connect

File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 571, in create_connection

You have to increase the number of maximum open files on your machine.

Here is an article how this can be accomplished in ubuntu.

Similar problem is answered on SO.

Increasing number of max files open (like proposed by Hinata) is indeed a short-term solution, but I am surprised that you hit this limit in the first place. I don't see why successive GET would open so many files.

My recommendation would be to try out another library to check if this problem remains. You can try out Robot Framework Requests one or you can directly call Requests Python lib. You might want to take a look at a short blog post about this topic I wrote.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM