Modify

#3111 closed Bug (Fixed)

Allow for parallel compilations

Reported by: adrienc@… Owned by: Jos
Milestone: Component: SciTE4AutoIt
Version: 3.3.14.0 Severity: None
Keywords: Cc:

Description

Hello,

In my company we have a lot (around 100-150) of AutoIt programs of various size. So first: thank you for your great language!!!

We have a script to compile all our programs. We run it several times a day.
We have tried to speed up the compilation duration by calling AutoItWrapper.exe multiple times (in parallel), in order to benefit from all the CPU cores on our server.

However that caused us big troubles. For example, some executables were mixed or swapped (i.e. programA.exe and programB.exe are both the executable file for programA.au3, and the code in programB.au3 is compiled nowhere).

To reproduce, just try to Run() 3 or 4 AutoItWrapper.exe programs in parallel.

Could you please try to solve this issue, as it would really improve our compilation time ?
Thank you!!!!

Attachments (1)

autoit_3111.zip (4.3 KB ) - added by adrienc@… on Aug 22, 2015 at 4:24:35 PM.

Download all attachments as: .zip

Change History (18)

comment:1 by BrewManNH, on Aug 21, 2015 at 3:53:24 AM

Are you actually running AutoIt3Wrapper, or are you running Aut2Exe? Have you tried compiling multiple scripts using just Aut2Exe and running them simultaneously?

comment:2 by Jos, on Aug 21, 2015 at 10:01:03 PM

Build be a replication example and I will have a look, but don;t expect me to do the work first to replicate a possible bug.

Jos

Version 0, edited on Aug 21, 2015 at 10:01:03 PM by Jos (next)

comment:3 by Jos, on Aug 22, 2015 at 3:58:11 PM

Component: Aut2ExeSciTE4AutoIt
Owner: set to Jos
Status: newassigned

by adrienc@…, on Aug 22, 2015 at 4:24:35 PM

Attachment: autoit_3111.zip added

comment:4 by adrienc@…, on Aug 22, 2015 at 4:27:50 PM

Hello,

Here is a replication example, it is supposed to compile 5 programs named Program1.exe, Program2.exe, ..., Program5.exe. Each of these programs show a GUI with its name in a big label ("Program 1" is displayed by Program1.exe, and so on).

On my computer and our servers it does several errors, sometimes some programs are compiled and as you can see when running those compiled programs, they are not the right ones.

For instance Program2.exe will show "Program 5" and have no description on it.

Thank you for your time and your work on AutoIt !!!

comment:5 by Jos, on Aug 22, 2015 at 8:16:10 PM

This issue seems to stem from the _tempfile() udf which will generate the same name when ran with a certain timeframe. Things seems to work when I put a sleep between the compile lines:

	StartCompilation("Program1")
	sleep(2000)
	StartCompilation("Program2")
	sleep(2000)
	StartCompilation("Program3")
	sleep(2000)
	StartCompilation("Program4")
	sleep(2000)
	StartCompilation("Program5")

Just a workaround for the moment,while I check how this can be resolved.
Jos

comment:6 by Jos, on Aug 22, 2015 at 10:15:59 PM

Please give the current beta a try. also remember I am not supplying compiled scripts any more, so your program should look like this now:

#include <Constants.au3>

If $CmdLine[0] = 0 Then ; Main program
	StartCompilation("Program1")
	StartCompilation("Program2")
	StartCompilation("Program3")
	StartCompilation("Program4")
	StartCompilation("Program5")
Else
	Compile($CmdLine[1])
EndIf

Exit

Func StartCompilation($a)
	Run('"C:\Program Files (x86)\AutoIt3\AutoIt3.exe" ' & @ScriptName & ' ' & $a, @ScriptDir, @SW_HIDE)
EndFunc   ;==>StartCompilation

Func Compile($a)
	Local $iPID = Run('"C:\Program Files (x86)\AutoIt3\autoit3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /in ' & $a & '.au3 /out ' & $a & '.exe /nopack /NoStatus', @ScriptDir, @SW_SHOW, $STDOUT_CHILD)
	Local $sOutput = ""
	While 1
		$sOutput = StdoutRead($iPID)
		If @error Then ExitLoop
		If ($sOutput <> "" And (StringInStr($sOutput, "error:") Or StringInStr($sOutput, "warning:"))) Then
			MsgBox(16, "ERROR - Compilation ABORTED", "When compiling the file " & $a & ".au3, AutoIt Compiler returned (stdout):" & @CRLF & @CRLF & $sOutput)
			Exit
		EndIf
	WEnd
EndFunc   ;==>Compile

Jos

comment:7 by adrienc@…, on Aug 23, 2015 at 1:48:46 PM

Hello,

I have installed the Beta, but things are still the same.

Quick question: is it me or the Beta did not update the file AutoIt3Wrapper.au3 ?
Maybe this is the reason why the bug is not fixed, and you need to provide me the new AutoIt3Wrapper.au3 file?

Thank you for your time!

comment:8 by Jos, on Aug 23, 2015 at 4:02:44 PM

You need to go to the SciTE4AutoIt3 Beta subdirectory, not the Beta AutoIt3 installer.
https://www.autoitscript.com/autoit3/scite/download/beta_SciTE4AutoIt3/
Download the AutoI3Wrapper.zu3 from there and replace the current one.
Don't forget to update your SciTE setup as I am not providing any EXE's anymore for scripts.

Jos

comment:9 by adrienc@…, on Aug 23, 2015 at 8:05:28 PM

Hello,

Even with the beta version of AutoIt3Wrapper.au3 I still have mixed executable files.

I do not know if this can help you, but here is the error message I get 50% of the time:

Error: EndUpdateResource: Returncode = 0 - LastError:5:Acces denied.

comment:10 by Jos, on Aug 23, 2015 at 9:49:10 PM

Are you sure you are using the script and new source I provided?
I have tested many times with your provided example and things were working after the modifications I have made.

Jos

comment:11 by adrienc@…, on Aug 23, 2015 at 10:23:02 PM

Hello,

I have uninstalled AutoIt3, AutoIt3 Beta and SciTe.
I have then installed, in this order: AutoIt, AutoIt3 Beta, SciTe.
Then I have downloaded the beta AutoIt3Wrapper.au3 and put it in the Beta directory.

The script I am using is this one:

#include <Constants.au3>

If $CmdLine[0] = 0 Then ; Main program
	StartCompilation("Program1")
	StartCompilation("Program2")
	StartCompilation("Program3")
	StartCompilation("Program4")
	StartCompilation("Program5")
Else
	Compile($CmdLine[1])
EndIf

Exit

Func StartCompilation($a)
	Run('"C:\Program Files (x86)\AutoIt3\Beta\AutoIt3.exe" ' & @ScriptName & ' ' & $a, @ScriptDir, @SW_HIDE)
EndFunc   ;==>StartCompilation

Func Compile($a)
	Local $iPID = Run('"C:\Program Files (x86)\AutoIt3\Beta\autoit3.exe" "C:\Program Files (x86)\AutoIt3\Beta\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /in ' & $a & '.au3 /out ' & $a & '.exe /nopack /NoStatus', @ScriptDir, @SW_HIDE, $STDOUT_CHILD)
	Local $sOutput = ""
	While 1
		$sOutput = StdoutRead($iPID)
		If @error Then ExitLoop
		If ($sOutput <> "" And (StringInStr($sOutput, "error:") Or StringInStr($sOutput, "warning:"))) Then
			MsgBox(16, "ERROR - Compilation ABORTED", "When compiling the file " & $a & ".au3, AutoIt Compiler returned (stdout):" & @CRLF & @CRLF & $sOutput)
			Exit
		EndIf
	WEnd
EndFunc   ;==>Compile

Am I doing something wrong? Am I forgetting to do something?
Thank you very much!!

comment:12 by Jos, on Aug 24, 2015 at 7:11:18 PM

Looks good to me ... and you still have the same issue?
Any AV installed and do you have the temp directory excluded: "%localappdata%\AutoIt v3" ?

Jos

comment:13 by adrienc@…, on Aug 24, 2015 at 8:42:32 PM

Hello,

Sorry, no AV installed, WinDefender disabled...

I always get this error:

Error: EndUpdateResource: Returncode = 0 - LastError:5:Acces denied.

comment:14 by Jos, on Aug 24, 2015 at 9:01:13 PM

.. and this is for all 5 when running the batch script and things are working fine when doing one?

Jos

comment:15 by adrienc@…, on Aug 25, 2015 at 9:00:18 AM

I get between 1 and 3 errors when running the batch script, and things are working gine when doing one.

comment:17 by Jos, on Aug 25, 2015 at 8:51:33 PM

I have ran your example again a couple of times and have no issues any more.

One other question: why do you have Scite in the Beta directory?
"C:\Program Files (x86)\AutoIt3\Beta\SciTE\AutoIt3Wrapper
There is no need for that and never done by the standard installers.

There is not much I can do more at this moment unless I can get it to replicate your problem.
There were several fixes in the code using the same file and also the _tempfile() returned the same name in case it was called within a certain timeframe, but those should all be sorted now.

Jos

comment:18 by Jos, on Sep 1, 2015 at 4:52:55 PM

Resolution: Fixed
Status: assignedclosed

Closing this report.

Jos

Modify Ticket

Action
as closed The owner will remain Jos.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.