You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When making URL requests via the DRMS Client class, network connections do not timeout and fail gracefully. This leads to requests such as "query", "export", and "download" to stall indefinitely when the server fails to respond, requiring a program restart to recover.
Expected vs Actual behavior
When making requests such as "query", "export", and "download" using the Client class, it is expected that the network communication should timeout and possibly return some sort of network timeout error if a response is not received from the requested server. Alternatively, the Client could capture such errors and attempt a retry itself. This, however, is not the behavior exhibited by the Client class.
Steps to Reproduce
This is an intermittent issue when in actual production, but one could possibly reproduce by severing network connection prior to or in the middle of making such requests.
The root cause of this issue is most likely in the drms/json.py module line 66, and in the drms/client.py module line 591
The json.py module might be fixed by providing a default timeout value to the urlopen method call. When none is provided, the method utilizes the socket._GLOBAL_DEFAULT_TIMEOUT as can be seen in the implementation code here. It is also mentioned in the documentation for the method here:
"The optional timeout parameter specifies a timeout in seconds for blocking operations like the connection attempt (if not specified, the global default timeout setting will be used)"
Though what is not mentioned is that the socket._GLOBAL_DEFAULT_TIMEOUT is set to None by default and therefore a timeout never occurs. This is, however, documented in the socket._GLOBAL_DEFAULT_TIMEOUT documentation:
"Return the default timeout in seconds (float) for new socket objects. A value of None indicates that new socket objects have no timeout. When the socket module is first imported, the default is None."
The drms/client.py is most likely caused by a similar assumption, but the urlretrieve method does not provide for supplying a timeout, so some other solution would be necessary, such as replacing urlretrieve with urlopen so that a default timeout can be provided.
Alternatively, a solution to both may be to utilize the socket.setdefaulttimeout upon module import of both/either drms/json.py and/or drms/client.py.
System Details
SunPy Version: 2.0.4
Astropy Version: 4.1
Python Version: 3.7.8
OS information: Ubuntu Linux 20.04 (but this will occur with all operating systems as it comes from improper assumptions about socket._GLOBAL_DEFAULT_TIMEOUT)
The text was updated successfully, but these errors were encountered:
Description
When making URL requests via the DRMS Client class, network connections do not timeout and fail gracefully. This leads to requests such as "query", "export", and "download" to stall indefinitely when the server fails to respond, requiring a program restart to recover.
Expected vs Actual behavior
When making requests such as "query", "export", and "download" using the Client class, it is expected that the network communication should timeout and possibly return some sort of network timeout error if a response is not received from the requested server. Alternatively, the Client could capture such errors and attempt a retry itself. This, however, is not the behavior exhibited by the Client class.
Steps to Reproduce
This is an intermittent issue when in actual production, but one could possibly reproduce by severing network connection prior to or in the middle of making such requests.
The root cause of this issue is most likely in the drms/json.py module line 66, and in the drms/client.py module line 591
The json.py module might be fixed by providing a default timeout value to the urlopen method call. When none is provided, the method utilizes the socket._GLOBAL_DEFAULT_TIMEOUT as can be seen in the implementation code here. It is also mentioned in the documentation for the method here:
"The optional timeout parameter specifies a timeout in seconds for blocking operations like the connection attempt (if not specified, the global default timeout setting will be used)"
Though what is not mentioned is that the socket._GLOBAL_DEFAULT_TIMEOUT is set to None by default and therefore a timeout never occurs. This is, however, documented in the socket._GLOBAL_DEFAULT_TIMEOUT documentation:
"Return the default timeout in seconds (float) for new socket objects. A value of None indicates that new socket objects have no timeout. When the socket module is first imported, the default is None."
The drms/client.py is most likely caused by a similar assumption, but the urlretrieve method does not provide for supplying a timeout, so some other solution would be necessary, such as replacing urlretrieve with urlopen so that a default timeout can be provided.
Alternatively, a solution to both may be to utilize the socket.setdefaulttimeout upon module import of both/either drms/json.py and/or drms/client.py.
System Details
The text was updated successfully, but these errors were encountered: