[Swift-devel] Swift crashing for runs with 1M calls

Mihael Hategan hategan at mcs.anl.gov
Mon Mar 11 15:42:04 CDT 2013


On Tue, 2013-03-12 at 02:06 +0530, Yadu Nand wrote:
> >> So, any loop large enough with a dependency on previous values could
> >> trigger this error ? Throwing more memory into the system or giving more
> >> time wouldn't help this, right ?
> >
> > Right. Though I was wrong about 2^n, it's O(n) instead, but still enough
> > to cause a stack overflow.
> 
> Okay. Hmm.. so we could measure how much more loops we can afford
> with more memory.

Well, no. The hang checker should be limited to searching for limited
size loops. The usefulness of a message showing the dependency graph of
the fib series with 1M elements will not be very useful.

> 
> >> I'm also seeing swift hung, after I removed the dependency, probably a
> >> different issue.
> >> Here's what I see : http://pastebin.com/J9V3xyqU
> >> I killed the process after 15 mins.
> >
> > Not sure what you mean by "removing dependency".
> 
> I just removed the dependency on array values filled in by previous threads.
> instead of array[n] = array[n-1] + array[n-2], I went with array[n] = n*n;
> So hang checker would determine that the threads of execution are independent,
> right ?

Correct. You should not get a stack overflow even if the hang checker is
invoked.

> 
> >[...]
> >
> > The problem is in the array = range() assignment. The creation of 1M
> > swift array data elements is slow. Slow enough to trigger the hang
> > checker. At least that's my take on it.
> 
> Oh cool! The code without the range assignment, ran 1M loops.
> 1M   in 1m22.327s (I think this is a big improvement)
> 10M -> crashes with error (http://pastebin.com/bac6FEms)

I'm not surprised 10M threads is a lot.

Mihael




More information about the Swift-devel mailing list