digitalmars.D.learn - segfault when using std.parallelism and std.process.executeShell
- Nikhil Padmanabhan (24/24) Dec 12 2013 Hi,
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (4/28) Jan 07 2014 I don't know the original problem but that program works without any
- Kelet (2/4) Jan 07 2014 Works for me on dmd v2.064 (current stable) on Windows.
Hi, The following code dies with a segfault : import std.stdio, std.parallelism, std.process; void main() { auto a=["hello","world","goodbye"]; foreach(s; parallel(a,1)) { auto ls=executeShell("echo "~s); writeln(ls.output); } } both in ldc and dmd. Removing either the "parallel" or running something other than executeShell (eg. just doing a writeln) works, which suggests to me that it's something about the way executeShell is interacting with parallel. Pulling it up in lldb, I get : test`D3std7process7environFNbNdNeZxPPa + 20, stop reason = EXC_BAD_ACCESS (code=1, address=0x0) test`D3std7process7environFNbNdNeZxPPa + 20 Any thoughts on what might be going wrong? Is executeShell somehow not threadsafe? Thanks! -- Nikhil
Dec 12 2013
On 12/12/2013 08:33 PM, Nikhil Padmanabhan wrote:Hi, The following code dies with a segfault : import std.stdio, std.parallelism, std.process; void main() { auto a=["hello","world","goodbye"]; foreach(s; parallel(a,1)) { auto ls=executeShell("echo "~s); writeln(ls.output); } }I don't know the original problem but that program works without any problem with the current dmd on github. Aliboth in ldc and dmd. Removing either the "parallel" or running something other than executeShell (eg. just doing a writeln) works, which suggests to me that it's something about the way executeShell is interacting with parallel. Pulling it up in lldb, I get : test`D3std7process7environFNbNdNeZxPPa + 20, stop reason = EXC_BAD_ACCESS (code=1, address=0x0) + 20 Any thoughts on what might be going wrong? Is executeShell somehow not threadsafe? Thanks! -- Nikhil
Jan 07 2014
On Tuesday, 7 January 2014 at 23:12:09 UTC, Ali Çehreli wrote:don't know the original problem but that program works without any problem with the current dmd on github.Works for me on dmd v2.064 (current stable) on Windows.
Jan 07 2014