One thought on “Abnormal delays when using threads”
We are doing HTTP communication on a background thread in order to keep the communication channel with the main MCU free and responsive. Today I noticed that sometimes there is a really long delay from when we begin setting up a socket to when the HTTP request is finished and the socket is closed:
1142.626 DataHandler.py:26 Task started
1142.639 DataHandler.py:23 Create session
1142.677 Http.py:3 GET http://……, parameters=None, headers=None
1148.812 EHttp.py:79 Creating socket
1148.829 EHttp.py:80 Setting socket options
1148.840 EHttp.py:84 Setting TCP_NODELAY
1148.851 EHttp.py:84 Connecting
1150.093 EHttp.py:47 Closing socket
After the thread has been created it takes 6 seconds before the thread can continue setting up the socket. Is this normal?
sys.getcheckinterval() is 100.
EDIT: It seems like the delay only exists on the first HTTP call. After that, the entire request takes around 400ms.
We use cookies to enhance your browsing experience and help us improve our websites. To improve our website, we carefully select third parties that use cookies to allow us to serve specific content and achieve the purposes set out in our cookie policy. For more information on how to make adjustments through your browser to the cookies being used on your device, please click Find Out More link. By closing this banner or continuing to browse our website, you agree to our use of such cookies. FIND OUT MORE
We are doing HTTP communication on a background thread in order to keep the communication channel with the main MCU free and responsive. Today I noticed that sometimes there is a really long delay from when we begin setting up a socket to when the HTTP request is finished and the socket is closed:
1150.093 EHttp.py:47 Closing socket
After the thread has been created it takes 6 seconds before the thread can continue setting up the socket. Is this normal?
sys.getcheckinterval() is 100.