Solved

InternetReadFile 100% cpu usage

Posted on 2007-03-28
6
551 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

623 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