Peter Duniho
5/13/2008 6:35:00 PM
On Tue, 13 May 2008 07:29:50 -0700, Peter Larsen [CPH]
<PeterLarsen@community.nospam> wrote:
> [...]
> I agree that it must be a recursion problem.
> The problem is that some of the code is "build" at runtime from some xml
> files and no one seems to know whether its the code-builder or some
> entries
> in the xml files, that fails. It would be nice to know where the
> exception
> is thrown, right !
It would be nice, yes. But it's not strictly speaking necessary.
The best scenario is that you can run the process in a debugger and get it
to crash. Then in the debugger, you'll be able to see where the exception
happens.
But the "non-best" scenario isn't that bad. First of all, I can tell you
for sure it's not your XML files per se. That's input, and no correct
program should ever crash just because it was given bad input. Besides
that, while XML processing does lend itself to recursion, the XML files
themselves should not be able to be created in a way that would result in
unbounded recursion. After all, that would require an infinitely large
XML file, or at the very least an exceptionally large one (with perhaps
millions of levels of nesting).
Now, is it possible that the XML files themselves somehow describe an
algorithm that your code builder creates that is itself flawed? I suppose
so. Ideally, you would not be building code from an XML description that
could result in that, but I don't know anything about the problem your
program actually solves so I can't say whether this ideal is achievable.
But, even if we assume that your XML describes a flawed algorithm, it
should be possible to track that down. In particular, you should be able
to keep a log of the code that's generated based on the XML, and then if
and when a crash happens, inspect the most-recently executed code to find
out why it crashed.
I agree that it would be a lot easier if there were a way for you to
catch, or at least log, the exception. But, I've debugged much harder
problems with less information and available resources. Your problem
isn't intractable. It's just going to require a bit more legwork. :)
Between judicious tracing of your program's execution, logging of data
processed and generated, and back-to-basics code inspection, it should be
solvable. The fact that this is almost certainly related to an issue with
recursion is a major clue, and should be able to help you drastically
reduce your search space.
Pete