Using executeShell in multiple thread causes access violation error

ZombineDev via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 17 18:40:53 PDT 2015


On Monday, 13 July 2015 at 09:46:26 UTC, Minas Mina wrote:
> I have written a script that visits all directories in the 
> current directory and executes a command. In my case, "git 
> pull".
>
> When running the script serially, everything is fine. All git 
> repositories are pulled.
>
> But I'd like to pull multiple repositories in parallel to speed 
> things up.
> So I've changed my loop
> from foreach(entry; dirs)
>    to foreach(entry; parallel(dirs))
>
> After a while that the program is running I get:
> std.exception.ErrnoException at std\stdio.d(638): Could not close 
> file `HANDLE(C0)'
>  (No error)
> ----------------
> 0x00411E5C
> 0x0040B8AB
> 0x0040A146
> 0x00402288
> 0x00403A99
> 0x00413B95
> 0x004095FC
> 0x00439AA0
> 0x770992B2 in RtlInitializeExceptionChain
> 0x77099285 in RtlInitializeExceptionChain
> object.Error@(0): Access Violation
> ----------------
> 0x00439429
> 0x0043A277
> 0x00411ECD
> 0x763A9B2C in GetFileAttributesW
>
> Here is the code: http://pastebin.com/Tk0TBGxs

Probably this is a Windows only problem. I tried the following 
code on my Linux machine and I didn't get any exception like 
yours:
https://gist.github.com/ZombineDev/e1e48a18a22d4fc85e8d

Can you run my code just so we can confirm that the problem is in 
the Windows implementation and not in your code? Also what 
compiler version are you using? If you don't get exception while 
using your code, it would be better if you could show me a 
complete code snippet so the issue can be reproduced.


More information about the Digitalmars-d-learn mailing list