In httpserver.py we use timeouts for ensuring that communication with the client does not take too long time - if it does, we abort the request. However, we do not deactivate the timer once the call in question has finished, meaning that the timeout can trigger despite it no longer being relevant.
When monitoring a call, we should also make sure to deactivate the monitoring once it has finished.
Tested by starting a timeout and calling sleep() to trigger it, and could see that cancelling the timeout caused the "true" error message to be logged instead of the less interesting timeout error.
Tester should note that the main issue of this bug is that timeouts can trigger in exception handling, which then can hide error messages by only displaying a message about timeout error.
I can verify that this works as expected. This is what I tested, both for the tls handshake and the request timeout:
1. Set timeout
2. Call the function we are monitoring
3. The function raises an exception*
4. Add sleep() in the exception handling code*
*Had to put in some bad code to trigger the behavior.
Then I checked the logs and could see that before there was no informative error message. Now there is. The timeout is now cancelled both when everything worked fine and when there is an exception.