www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Using executeShell in multiple thread causes access violation error

reply "Minas Mina" <minas_0 hotmail.co.uk> writes:
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 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
Jul 13 2015
next sibling parent reply "Minas Mina" <minas_0 hotmail.co.uk> writes:
bump
Jul 17 2015
parent reply ketmar <ketmar ketmar.no-ip.org> writes:
On Fri, 17 Jul 2015 22:53:55 +0000, Minas Mina wrote:

 bump
sorry, i was wrong about GC non-calling. yet we still need more info: how=20 long it works before crashing, how much threads it runs, how many "git=20 clone" commands were ok before crach, what DMD version are you using, and=20 *full* source code that reproduces crash, preferably without needing to=20 clone 100500 repositories. ;-) seems that you hit a bug in runtime or compiler, so we need as much info=20 as you can provide to localize the bug.=
Jul 19 2015
parent Gomen <gomen asai.jp> writes:
On Sunday, 19 July 2015 at 13:41:19 UTC, ketmar wrote:
 On Fri, 17 Jul 2015 22:53:55 +0000, Minas Mina wrote:

 bump
sorry, i was wrong about GC non-calling. yet we still need more info: how long it works before crashing, how much threads it runs, how many "git clone" commands were ok before crach, what DMD version are you using, and *full* source code that reproduces crash, preferably without needing to clone 100500 repositories. ;-) seems that you hit a bug in runtime or compiler, so we need as much info as you can provide to localize the bug.
I encounter this error all the time with my project - https://github.com/beast-lang/compiler just compile compiler and testsuite and run testsuite
Mar 16 2017
prev sibling parent "ZombineDev" <valid_email he.re> writes:
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 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.
Jul 17 2015