Link to home
Start Free TrialLog in
Avatar of Relegence
RelegenceFlag for Israel

asked on

InternetReadFile 100% cpu usage

Hi,

im using InternetReadFile win api function on this url : http://fotball.aftenposten.no/tv/article77811.ece
from some reason the last chunk im trying to read is stuck and cause 100% cpu utilization and doesn't seems to end, i did some google, and found out this kb from Microsoft: http://support.microsoft.com/kb/263754
 i tried what was recommended there and it didn't work, does anyone has new idea about it ?

Thanks,
Amit



Avatar of Deepu Abraham
Deepu Abraham
Flag of United States of America image

It's c learly written, 'The problem is caused by a bug in the InternetReadFile API. Under some conditions, InternetReadFile fails to detect a connection closure and still tries to read data from the socket. '

RESOLUTION
----------------
Because this problem only occurs when chunked encoding is used, you can disable chunked encoding to solve the problem. Because chunked encoding is not used with HTTP 1.0, you can work around this problem by using HTTP
1.0
To do so you must:
1. Specify HTTP/1.0 in the HttpOpenRequest API.
2. In Internet Explorer, from the Tools menu, click Internet Options, and then select the Advanced tab. Clear the Use HTTP 1.1 and Use HTTP 1.1 through proxy connections check boxes.

Did you try this?
Best Regards,
DeepuAbrahamK
Avatar of Relegence

ASKER

of course i tried that,  :-)
Read this also, if you are not able to specify the http version by using HttpOpenRequest().
http://support.microsoft.com/kb/258425/EN-US/
Best Regards,
DeepuAbrahamK
ASKER CERTIFIED SOLUTION
Avatar of itsmeandnobodyelse
itsmeandnobodyelse
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Guys, thanks you all for your quick responses,
i already tried  the "watchdog" option itsmeandnobodyelse suggested , this approach imposes another problem because there is not safe way to kill threads without causing memory leaks, i think the solution is here : http://www.codeproject.com/internet/asyncwininet.asp?df=100&forumid=1409&exp=0&select=975072

Amit

Amit, you shouldn't give C grade without further feedback. If you found the solution yourself you could tell the moderator and get points back. Or if you think that one or more comments have helped give a B grade which was appropriate. A C grade is appropriate if you asked for more help but didn't get it. Or if it was a really poor help such as "Help yourself and look at your sources".

I personally prefer to get no points rather than a C grade.

Regards, Alex