stevedlawrence commented on a change in pull request #135: Show different error
message for OOM
URL: https://github.com/apache/incubator-daffodil/pull/135#discussion_r232822408
##########
File path:
daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/parsers/Parser.scala
##########
@@ -271,7 +271,7 @@ class ChoiceParser(ctxt: RuntimeData, val childParsers:
Vector[Parser])
case t: Throwable => {
if (pBefore != null) {
markLeakCausedByException = true
- if (!t.isInstanceOf[SchemaDefinitionDiagnosticBase] &&
!t.isInstanceOf[UnsuppressableException]) {
+ if (!t.isInstanceOf[SchemaDefinitionDiagnosticBase] &&
!t.isInstanceOf[UnsuppressableException] && !t.isInstanceOf[OutOfMemoryError]) {
Review comment:
This pattern of schema checking also appears in SequenceParserBases.scala,
we probably need a similar check there.
Also, rather than checking the very specific OutOfMemoryError, perhaps we
instead want to check it's parent java.lang.Error,? The javadoc says
java.lang.Error "indicates a serious problem that a reasonable application
should not try to catch". So on any java.lang.Error we still attempt to clean
up the MarkPool but don't try to warn about an unexpected exception thrown. The
below message is really trying to tell when Daffodil failed to catch an
exception that it should have caught elsewhere else.
This also makes me wonder if we shouldn't even be catch/using Throwable's
anywhere, but instead only catch java.lang.Exceptions? I'm pretty sure we use
Throwables all over the place, so it's not worth changing for this bug, but
might be worth creating a new bug to reexamine our usage of Throwables vs
Exceptions.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services