jirentabu / crashrpt

Automatically exported from code.google.com/p/crashrpt
0 stars 0 forks source link

HttpEndRequest() fails. GetLastError() = ERROR_INTERNET_TIMEOUT (12002) #138

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Unfortunatelly there are no specific steps. I'm just using a folder in my 
domain to store the reports. The only relevant thing I might think of is that 
my internet connection is slow, and that it's a shared host.

What is the expected output? What do you see instead?
The expected output is HTTP code 200. I'm getting "HttpEndRequest has failed." 
in the log.

What version of CrashRpt are you using?
1.3.0

What is your version of Visual Studio?
2008

What is your version of Windows operating system?
Win7 x86 SP1

Please provide any additional information below.
I managed to solve the problem by setting all TIMEOUT options to 0, for both 
hSession and hConnect in CHttpRequestSender::InternalSend(). 0xFFFFFFFF didn't 
work! The options set were: INTERNET_OPTION_CONNECT_TIMEOUT, 
INTERNET_OPTION_SEND_TIMEOUT, INTERNET_OPTION_RECEIVE_TIMEOUT.

There's probably another way of doing it but this works for me atm. It would be 
nice to be able to specify a timeout period in CR_INSTALL_INFO, in order to 
prevent this error.

One last question: Was I supposed to see the log window until the transaction 
finishes, or it's normal for it to close before getting the response back from 
the server?

Great library btw :) Works as advertised out of the box.

Original issue reported on code.google.com by makingar...@gmail.com on 11 Mar 2012 at 7:40

GoogleCodeExporter commented 9 years ago
Forget the question about the log window closing before getting a response from 
the server :) I didn't see the icon that appears on the tray. 

Original comment by makingar...@gmail.com on 11 Mar 2012 at 7:55

GoogleCodeExporter commented 9 years ago
I'm not sure it would be correct to set timeout to zero (infinite timeout), 
because the code may block forewer if there is no internet connection. However, 
I'll try to figure out what can be done here.

Original comment by zexspect...@gmail.com on 12 Mar 2012 at 10:37

GoogleCodeExporter commented 9 years ago
You are right of course. I'll have to check if setting only 
INTERNET_OPTION_SEND_TIMEOUT to a high value (e.g. 5 - 10 minutes) would be 
enough for this case. The other 2 timeout options shouldn't be relevant. 

I haven't really used WinINet API before. This is probably a silly question, 
but in the case where there's no internet connection at all, shouldn't it have 
failed some places earlier (instead of HttpEndRequest())? E.g. at the time the 
connection is established.

Looking forward to your solution.

Original comment by makingar...@gmail.com on 12 Mar 2012 at 11:02

GoogleCodeExporter commented 9 years ago
More details: It seems that in my case (slow upload => slow response from the 
server) setting hSession's INTERNET_OPTION_RECEIVE_TIMEOUT to 0 is enough 
without touching the rest of the timeout options. 

Also, if there is no internet connection, timeout isn't an issue. In this case 
it fails at HttpSendRequestEx with error code 12007 
(ERROR_INTERNET_NAME_NOT_RESOLVED). 

One small detail I forgot to mention earlier. Even if I leave the code as is 
(default timeouts), the php script executes normally (responds with code 200 
and sends me an email, given enough time). The actual problem is on the user 
side. The user ends up seeing the log dialog with the error mentioned in the 
first post, and he doesn't know if the report has been actually sent or not.

Hope that helps.

Original comment by makingar...@gmail.com on 12 Mar 2012 at 4:21

GoogleCodeExporter commented 9 years ago
I added the following code to resolve your problem:

HttpRequestSender.cpp:line 144
// Set large receive timeout to avoid problems in case of 
// slow upload => slow response from the server.
DWORD dwReceiveTimeout = 0;
InternetSetOption(hConnect, INTERNET_OPTION_RECEIVE_TIMEOUT, 
    &dwReceiveTimeout, sizeof(dwReceiveTimeout));

Original comment by zexspect...@gmail.com on 26 Aug 2012 at 4:29

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r1352.

Original comment by zexspect...@gmail.com on 26 Aug 2012 at 4:30