cpprestsdk
cpprestsdk copied to clipboard
Failed to read HTTP status line results in client never being able to be used again
I am not sure why but I've suddenly been seeing this message show up. However, when I hit it, then any subsequent call through the client will result in the same message. It almost seems as if there is some clean up that needs to happen in order to allow other requests to work.
For clarity not every call does this. I'm trying to figure out the trigger point for when I'll see this issue. In other words I can do several successful calls through the client. And then suddenly I will get this problem and once I do, the only remedy is to force exit the app.
I assume you mean you're seeing the message produced at https://github.com/Microsoft/cpprestsdk/blob/v2.10.1/Release/src/http/client/http_client_asio.cpp#L1174, is that right?
I think I've seen this error state in the client - along with a number of similar ones - when a server is overwhelmed and connections are being refused because its backlog is full. I don't think I've tried to reuse the same client after this; I wonder if the socket connection is in some state that prevents this working. Not a solution, just another data point...
@garethsb-sony yes, I believe that is it (line 1174). What I wondering if there is a gap in the logic where the connection and/or client need to be re-initialized or shutdown properly.
In my case, unfortunately this is more than likely not a case of anything overwhelming happening.
There was very low loading as I was getting up a new dev instance. Both the server and client use cpprestsdk. So I was the only one using the server was me and I only probably made a handful of requests from the client before this hit, and that is more than likely generous in the actual number of calls. It's the first time I've seen this issue and at this point most of the network code which is built onto of cpprestsdk has not changed for quite some time.
There have been no new library updates either for quite time time, although they will be upgraded along with the cpprestsdk in a week or two.
I can second this issue. It is very pone to happen on iOS clients that have been idle for some time. Refreshing the request 6-7 times (~10sec, reproducible) will kick-start the httpclient again. This is of course not ok, and for now we actually create a new client instance each request to circumvent this.
It seems to be timer-based. If i wait say 10 seconds after the first error, the second try will work immediately. Thus, it seems to be a timer issue more than anything.
Any deeper insight would be appreciated.
Very simple. The client does not receive any reply and times-out.
The error "Failed to read HTTP status line" means there was no status line in the reply. But this is actually an unfortunate message since there was no reply. I would expect simply "Client time-out".
So the problem is in the server, it either takes too long to give an answer or it crashed.