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

Mihael Hategan hategan at mcs.anl.gov
Sun Mar 10 23:09:29 CDT 2013


On Sat, 2013-03-02 at 00:53 +0530, Yadu Nand wrote:
> I'm trying to see swift behavior with some stress on and I see crashes at
> close to 1M calls/loops.
> [...]
> No events in 10s.
> [...]
> Progress:  time: Sat, 02 Mar 2013 00:23:08 +0530
> Finding dependency loops...Exception in thread "Hang checker"
> java.lang.StackOverflowError
> at java.util.HashMap.put(HashMap.java:484)
>  at java.util.HashSet.add(HashSet.java:217)
> at org.griphyn.vdl.karajan.HangChecker.findLoop(HangChecker.java:299)
>  at org.griphyn.vdl.karajan.HangChecker.findLoop(HangChecker.java:303)

Yeah, the algorithm for finding loops is recursive. Since it has to deal
with 1M threads, it does fail. The code may not be recursive, but the
dependency is, so when the hang checker builds the dependency graph, it
will essentially try to build a graph that tracks where, say,
array[1000000] is. The complexity of that  is 2^n in this case, so,
yeah...

One solution may be to stop the hang checker when things get too big.
That way it can still be useful for normal stuff.

The hang checker's invocation here is unfortunate though. the assignment
int range[] = [2:limit:1]; does the silly thing of actually creating an
array with 1M elements (if you say foreach v in range..., that does not
happen). It may be useful to change setFieldValue to do a simple
reference assignment instead of copying the entire array, but that might
not be easy given the way that assignment is implemented (i.e. not when
the array is created).

Mihael




More information about the Swift-devel mailing list