DMTF/Redfish-Service-Validator

Large memory footprint

mraineri opened this issue · 0 comments

Some internal users have noticed that when running the validator with a 32-bit version of Python, the tool can crash when testing a large service. Some errors include...

Retrying <URI> [HTTPSConnectionPool(host='<IP>', port=443): Max retries exceeded with url: <URI> (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x0380BC28>: Failed to establish a new connection: [WinError 10055] An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full'))]
  File "RedfishServiceValidator.py", line 9, in <module>
    main()
  File "C:\R\redfish_service_validator\RedfishServiceValidator.py", line 224, in main
    html_str = tohtml.renderHtml(results, tool_version, startTick, nowTick, currentService)
  File "C:\R\redfish_service_validator\tohtml.py", line 282, in renderHtml
    htmlPage += ''.join([tag.tr(x) for x in entry])
MemoryError
NOT writing online XML to file: RedfishExtensions_v1.xml
Traceback (most recent call last):
  File "C:\R\redfish_service_validator\RedfishServiceValidator.py", line 146, in main
    currentService = traverse.rfService(vars(args))
  File "C:\R\redfish_service_validator\traverse.py", line 75, in __init__
    self.catalog = catalog.SchemaCatalog(self.config['metadatafilepath'])
  File "C:\R\redfish_service_validator\catalog.py", line 104, in __init__
    schema = SchemaDoc(f.read(), self, my_name)
  File "C:\R\redfish_service_validator\catalog.py", line 173, in __init__
    self.soup = BeautifulSoup(data, "xml")
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\bs4\__init__.py", line 348, in __init__
    self._feed()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\bs4\__init__.py", line 434, in _feed
    self.builder.feed(self.markup)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\bs4\builder\_lxml.py", line 193, in feed
    markup = StringIO(markup)
MemoryError
Service could not be started: MemoryError()
Try running the Redfish Protocol Validator to ensure the service meets basic protocol conformance

From monitoring the memory usage, the tool does pretty quickly jump to a large memory footprint when building its data model tables. Using a 64-bit version of Python gets around this due to increased memory limits of the environment, but if there's a desire to support 32-bit Python instances, we might need to consider optimizing how the data model, responses, and results are cached. This may be a big effort, so it might not be worth pursuing.