#152 closed Bug (Fixed)
StdoutRead maxes CPU on process (when not run from SciTe).
| Reported by: | Owned by: | Valik | |
|---|---|---|---|
| Milestone: | 3.2.11.2 | Component: | AutoIt |
| Version: | 3.2.11.1 | Severity: | |
| Keywords: | Cc: |
Description
There appears to be a bug with StdoutRead that causes the spawned process to max out the CPU. I've provided two scripts, because this was the cleanest and simplest way I could discern to demonstrate the bug, I believe my code should work properly, although if there are errors with the code itself, feel free to ream me out for borking it.
Anyway, this first piece of code is the Child script, save it in a folder as TestChild.au3.
; Very simple script that should NOT max out the CPU
Do
ConsoleWrite('Loop')
Until MsgBox(4, '', 'Continue?') = 7
This second piece of code is the Parent script, save it in the same folder as TestChild.au3.
#include <Constants.au3>
Global $sOutput, $sStdoutRead
Global $iScriptPID = Run(FileGetShortName(@AutoItExe) & ' ' & FileGetShortName(@ScriptDir & '\TestChild.au3'), @ScriptDir, @SW_HIDE, $STDOUT_CHILD)
While 1
If $iScriptPID Then
$sStdoutRead = StdoutRead($iScriptPID)
If Not @error Then
If @extended Then
$sOutput &= $sStdoutRead & @LF
ToolTip('Parent PID: ' & @AutoItPID & @LF & 'Child PID: ' & $iScriptPID & @LF & $sOutput)
EndIf
Else
$iScriptPID = False
EndIf
Sleep(100)
Else
MsgBox(0, '', 'Parent exiting')
ExitLoop
EndIf
WEnd
Now, this is important, run the Parent script, but not through SciTe. I found that for whatever reason, running this code through SciTe doesn't give me any problems.
Now, while it's running have a look at your Task Manager, you should see that the child process is maxing out the CPU, and considering that it should be stopped on a MsgBox(), I really don't think it should be doing that.
Attachments (0)
Change History (3)
comment:1 by , 18 years ago
comment:2 by , 18 years ago
| Milestone: | → 3.2.11.2 |
|---|---|
| Owner: | set to |
| Resolution: | → Fixed |
| Status: | new → closed |
Fixed in version: 3.2.11.2
comment:3 by , 18 years ago
That was a rather strange bug. Actually seems to be a bug in how the Windows API works in a certain obscure scenario. Anyway, as noted by the auto-message, it's fixed in the next beta.

Valik should have a look at it as the beta StdOutRead has been redesigned
The Official release does experience such problem