spawn bug?
Jonathan M Davis
jmdavisProg at gmx.com
Sun Jan 23 20:44:05 PST 2011
On Sunday 23 January 2011 20:34:16 Adam Conner-Sax wrote:
> The attached code usually hangs (running on OSX, dmd 2.051).
>
> It uses spawn to create a new thread. All the thread does is create a
> large array of doubles. In one case it uses the Array!double from
> std.container. In the other case it uses the built in dynamic double[].
> It declares the array, sets the length, then sends a message to main
> saying it is finished and exits.
>
> The Array!double case always runs fine. The built-in dynamic array case
> usually hangs, though not always in the same place.
>
> And the array has to be sufficiently big (in my case 200000 or bigger I
> think) or the problem doesn't occur.
>
> I've no idea why. It took me a *long* time to find this since it
> manifested as very mysterious hanging in a more complex piece of threaded
> code. Now I've switched to using Array!double in my code and it all works
> fine.
>
>
> Adam
>
> (An example run)
>
> Spawned foo 1
> Spawned foo 2
> Spawned foo 3
> Spawned foo 4
> Finished foo 1
> Finished foo 2
> Finished foo 3
> Finished foo 4
> Spawned bar 1
> Spawned bar 2
> Spawned bar 3
> (stays here without finishing)
>
> begin 644 spawn.d
> M:6UP;W)T('-T9"YC;VYC=7)R96YC>3L*:6UP;W)T('-T9"YS=&1I;SL*:6UP
> M;W)T('-T9"YC;VYT86EN97(["FEM<&]R="!C;W)E+G1H<F5A9#L*"G9O:60@
> M9F]O*'5I;G0@:RP@=6EN="!L+%1I9"!M5&ED*2`*>PH@($%R<F%Y(61O=6)L
> M92!A<G(["B`@87)R+FQE;F=T:"AL*3L*("!S96YD*&U4:60L:RD["GT*"@IV
> M;VED(&)A<BAU:6YT(&LL('5I;G0@;"Q4:60@;51I9"D@"GL*("!D;W5B;&5;
> M72!A<G(["B`@87)R+FQE;F=T:"`](&P["B`@<V5N9"AM5&ED+&LI.PI]"@H*
> M=F]I9"!M86EN*"D@"GL*("!I;6UU=&%B;&4@=6EN="!M=6QT:7!L:65R(#T@
> M,3`P,#`P.PH@(&EM;75T86)L92!U:6YT(&Y4:')E861S(#T at -#L*("!A=71O
> M(&UA:6Y4:60@/2!T:&ES5&ED*"D["@H@(&9O<F5A8V@@*&L[(#$N+BAN5&AR
> M96%D<RLQ*2D@>PH@("`@875T;R!D=6UM>5]4:60@/2!S<&%W;B at F9F]O+&LL
> M:RIM=6QT:7!L:65R+&UA:6Y4:60I.PH@("`@=W)I=&5F;&XH(E-P87=N960@
> M9F]O("5S(BQK*3L*("!]"@H@(&9O<F5A8V at H:SL@,"XN;E1H<F5A9',I"B`@
> M("!R96-E:79E*"AU:6YT(&HI('L@=W)I=&5F;&XH(D9I;FES:&5D(&9O;R`E
> M<R(L:BD[('TI.PH*("!F;W)E86-H("AK.R`Q+BXH;E1H<F5A9',K,2DI('L*
> M("`@(&%U=&\@9'5M;7E?5&ED(#T@<W!A=VXH)F)A<BQK+&LJ;75L=&EP;&EE
> M<BQM86EN5&ED*3L*("`@('=R:71E9FQN*")3<&%W;F5D(&)A<B`E<R(L:RD[
> M"B`@?0H@(&9O<F5A8V at H:SL@,"XN;E1H<F5A9',I"B`@("!R96-E:79E*"AU
> M:6YT(&HI('L@=W)I=&5F;&XH(D9I;FES:&5D(&)A<B`E<R(L:BD[('TI.PH@
> &(`H@(`I]
> `
> end
Please don't post to the bug list. Ask about bugs on D.Learn or D, or just
report them in the tracker. This list is only meant for receiving messages from
the bug tracker.
There are several spawn bugs:
http://d.puremagic.com/issues/buglist.cgi?quicksearch=spawn
This one seems a likely culprit:
http://d.puremagic.com/issues/show_bug.cgi?id=4307
- Jonathan M Davis
More information about the Digitalmars-d-bugs
mailing list