Modify

Opened 12 years ago

Closed 11 years ago

#2284 closed Bug (Rejected)

InetClose() always returns false, repeated Inetget() causes high memory usage

Reported by: garbb Owned by:
Milestone: Component: AutoIt
Version: 3.3.8.1 Severity: None
Keywords: InetGet InetClose Cc:

Description

The help file says that InetClose() will return true if the handle was found and closed, but no matter what I tried I could not get it to return true, it will always return false. Try the test code right from the InetClose() part of the help file with one modification to output the return from InetClose() to the console:

Local $hDownload = InetGet("http://www.autoitscript.com/autoit3/files/beta/update.dat", @TempDir & "\update.dat", 1, 1)
Do
    Sleep(250)
Until InetGetInfo($hDownload, 2) ; Check if the download is complete.
Local $nBytes = InetGetInfo($hDownload, 0)
consolewrite(InetClose($hDownload)&@CRLF) ; Close the handle to release resources.
MsgBox(0, "", "Bytes read: " & $nBytes)

It will always return false.
Another thing that seemed weird is that the help file says that InetGet() with the background parameter set to 1 will return a handle but if you output it to the console you get '1'. In my experience with autoit when you try to display a handle in the console you will get either a hex number or a blank string, so maybe the issue is that InetGet() is not really returning a handle correctly?

As for the memory usage:
I ran a script that used InetGet() (and InetClose() to close the handles) to download a large number of files and after a few hours of running, the windows 'Superfetch' service and/or the 'Program Compatibility Assistant Service' had increased their memory usage to several hundred megabytes and the computer became unresponsive. Also, either the 'Program Compatibility Assistant Service' or the 'application experience' services had very high CPU usage. To test, goto the services tab of windows task manager and right click on the Superfetch service (listed as name='SysMain') and 'Program Compatibility Assistant Service' (listed as name='pcasvcs') and click 'Go to Process' and then watch those process's memory usage after hours of running the script below. (on the computers I have looked at the Superfetch and Program Compatibility Assistant Service were both using the same process.)
Using the information here: http://serverfault.com/questions/12278/how-to-find-memory-usage-of-individual-windows-services I was able to see what particular services were using up all the memory but you do not actually need to do this unless you are curious.

Here is my testing script for this. To get the results I got you will need to leave it running for many hours:
I used my own local webserver which I got here: http://www.ritlabs.com/en/products/tinyweb/download.php so I wouldn't hammer some website for this, but you could use any address.

while true
Local $hDownload = InetGet("http://127.0.0.1/index.html", @TempDir & "\update.dat", 1, 1)
Do
    Sleep(10)
Until InetGetInfo($hDownload, 2) ; Check if the download is complete.
InetClose($hDownload) ; Close the handle to release resources.
wend

I tried using InetRead() instead of InetGet() and it appears to have the same problem.
I also tried this with the 3.3.9.4 beta and found the same issues.
I tried changing the 'automatically detect settings' in the connection settings of internet settings because of this:http://www.autoitscript.com/trac/autoit/ticket/233 bug, but it didn't seem to change the results.
I should have probably mentioned that this is all running on windows 7.

Attachments (0)

Change History (1)

comment:1 Changed 11 years ago by Jon

  • Resolution set to Rejected
  • Status changed from new to closed

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.