I've seen problems where Skaringa gets into an infinite
recursion when it tries to marshal certain objects,
specifically Exception and descendants. After some
investigation it appears that the problem is that the
"cause" of the exception is initialized by default to
itself, so when Skaringa goes to serialize the cause it
gets into an infinite recursion (well, not infinite,
only until the stack overflows).
I'm not sure what the real solution is, but I've
implemented a work-around that seems to work well for
the cases that I've seen. Since the circularity is one
object that references itself in one of its members we
can just check that the member that we're about to
marshal isn't "self". Granted, larger loops (a -> b ->
a) will still cause problems, but those loops would
involve a lot more code to check, and marshalling
Exception can be useful.
This patch is:
- a new Exception test file
- a patch to ObjectSerializer to check for objects
that reference themselves
- a patch to the test cases
Log in to post a comment.