Skip to content

Redfish-Protocol-Validator getting stopped in latest version because socket ReadTimeout #87

@RonnieCheng66

Description

@RonnieCheng66

Since below change: Added timeout for HTTP requests
6a8f4f6

When I run the test with Tag 1.2.6 or master, the test gets stopped with the following error while checking function read_sse_events():

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 444, in _error_catcher
    yield
  File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 828, in read_chunked
    self._update_chunk_length()
  File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 758, in _update_chunk_length
    line = self._fp.fp.readline()
  File "/usr/local/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.7/ssl.py", line 1049, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.7/ssl.py", line 908, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 816, in generate
    yield from self.raw.stream(chunk_size, decode_content=True)
  File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 624, in stream
    for line in self.read_chunked(amt, decode_content=decode_content):
  File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 857, in read_chunked
    self._original_response.close()
  File "/usr/local/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.7/site-packages/urllib3/response.py", line 449, in _error_catcher
    raise ReadTimeoutError(self._pool, None, "Read timed out.")
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='172.31.97.118', port=443): Read timed out.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "rf_protocol_validator.py", line 9, in <module>
    main()
  File "/home/Linux_mandy/redfish_tool/Redfish-Protocol-Validator/redfish_protocol_validator/console_scripts.py", line 99, in main
    perform_tests(sut)
  File "/home/Linux_mandy/redfish_tool/Redfish-Protocol-Validator/redfish_protocol_validator/console_scripts.py", line 36, in perform_tests
    service_details.test_service_details(sut)
  File "/home/Linux_mandy/redfish_tool/Redfish-Protocol-Validator/redfish_protocol_validator/service_details.py", line 993, in test_service_details
    test_server_sent_events(sut)
  File "/home/Linux_mandy/redfish_tool/Redfish-Protocol-Validator/redfish_protocol_validator/service_details.py", line 974, in test_server_sent_events
    events = read_sse_events(response)
  File "/home/Linux_mandy/redfish_tool/Redfish-Protocol-Validator/redfish_protocol_validator/service_details.py", line 590, in read_sse_events
    for event in client.events():
  File "/usr/local/lib/python3.7/site-packages/sseclient/__init__.py", line 68, in events
    for chunk in self._read():
  File "/home/Linux_mandy/redfish_tool/Redfish-Protocol-Validator/redfish_protocol_validator/utils.py", line 249, in _read
    for data in super(SSEClientTimeout, self)._read():
  File "/usr/local/lib/python3.7/site-packages/sseclient/__init__.py", line 48, in _read
    for chunk in self._event_source:
  File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 822, in generate
    raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='172.31.97.118', port=443): Read timed out.

After observing this, I found that the issue is due to the periodic sending of keep-alive events on the SSE stream. Our server is configured with a keep-alive interval of 120 seconds, which significantly exceeds the tool's timeout setting of 30 seconds.

Q1: Is it expected behavior for the tool to stop and fail to generate a report when encountering a Read timed out error in this scenario?

Q2: Could you please confirm if the interval design of our server violates any part of the Redfish specification? Specifically, we are using a 120-second interval for sending keep-alive events over the SSE stream. Does this align with Redfish's guidelines, or should we consider adjusting it to better conform to best practices or compatibility with testing tools?

Thanks
BR,
Ronnie

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions