简体   繁体   English

打开的文件太多运行机器人框架测试用例时看到错误

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

I have a test suite with about 300 test cases. 我有一个包含300个测试用例的测试套件。 These test cases are HTTP API Calls. 这些测试用例是HTTP API调用。 All are 'GET' API calls. 都是“ GET” API调用。 The initial test cases execute fine. 最初的测试用例执行良好。 But towards the end of the execution, the error "error: [Errno 24] Too many open files" is thrown. 但是在执行结束时,将引发错误“错误:[Errno 24]打开的文件太多”。 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. 是一篇文章如何在ubuntu中完成。

Similar problem is answered on SO. 在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. 可以打开的最大文件数越来越多(例如Hinata提出的)确实是一种短期解决方案,但是我很惊讶您首先达到了此限制。 I don't see why successive GET would open so many files. 我不明白为什么连续的GET会打开这么多文件。

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. 您可以尝试一个Robot Framework Requests ,也可以直接调用Requests Python lib。 You might want to take a look at a short blog post about this topic I wrote. 您可能想看看有关我撰写的有关此主题简短博客文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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