Solved

InternetReadFile 100% cpu usage

Posted on 2007-03-28
6
549 Views
Last Modified: 2010-05-18
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



0
Comment
Question by:Relegence
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 11

Expert Comment

by:DeepuAbrahamK
ID: 18807144
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
0
 

Author Comment

by:Relegence
ID: 18807165
of course i tried that,  :-)
0
 
LVL 11

Expert Comment

by:DeepuAbrahamK
ID: 18807167
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
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 500 total points
ID: 18807180
I would assume it's another bug if the above doesn't help (you restarted the machine after changing to HTTP 1.1 Proxy?). Maybe a newer IE would solve the issue.

As a last resort you may put the call in a separate thread and set it to low priority. Then establish a watchdog which checks CPU and kills the thread if it runs into the infinite loop.

Regards, Alex
0
 

Author Comment

by:Relegence
ID: 18807619
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

0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 18808720
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
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Safe conversion? 4 86
trigs fail! I thought I knew how to do trignometry 3 94
Android development question 2 108
No module found pypyodbc, 3 56
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question