Project

Profile

Help

Bug #2555

closed

Bad parent pointer

Added by Gunther Rademacher almost 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Internals
Sprint/Milestone:
-
Start date:
2015-12-20
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.7
Fix Committed on Branch:
9.7
Fixed in Maintenance Release:
Platforms:

Description

When running the attached XQuery program on Saxon-EE 9.7, e.g. using this command line

java net.sf.saxon.Query JavaParser.xquery input="{class X{}}"

these messages appear on System.err:

*** Bad parent pointer found in $state at 4834 ***
*** Bad parent pointer found in $state at 4834 ***

The program still works as expected.

Sorry for not reducing this into a smaller test case. I will gladly attempt to do that, but it will require some effort, so I wanted to check first whether this is of interest at all, and if yes, whether it may possibly be analyzed using this fairly big program.

So far I have only done some debugging for getting the call stack of PrintWriter.println, when invoked for the first message:

		UserFunctionCall(Expression).checkedOperands() line: 136	
		UserFunctionCall(Expression).typeCheckChildren(ExpressionVisitor, ContextItemStaticInfo) line: 427	
		UserFunctionCall(FunctionCall).typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 173	
		UserFunctionCall.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 317	
		Operand.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 185	
		Choose.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 350	
		Operand.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 185	
		LetExpression.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 122	
		Operand.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 185	
		Choose.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 350	
		Operand.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 185	
		LetExpression.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 122	
		Operand.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 185	
		Choose.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 350	
		Operand.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 185	
		LetExpression.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 107	
		Operand.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 185	
		LetExpression.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 122	
		Operand.typeCheck(ExpressionVisitor, ContextItemStaticInfo) line: 185	
		LetExpression.optimize(ExpressionVisitor, ContextItemStaticInfo) line: 257	
		Operand.optimize(ExpressionVisitor, ContextItemStaticInfo) line: 200	
		Choose.optimize(ExpressionVisitor, ContextItemStaticInfo) line: 470	
		Operand.optimize(ExpressionVisitor, ContextItemStaticInfo) line: 200	
		LetExpression.optimize(ExpressionVisitor, ContextItemStaticInfo) line: 268	
		Operand.optimize(ExpressionVisitor, ContextItemStaticInfo) line: 200	
		LetExpression.optimize(ExpressionVisitor, ContextItemStaticInfo) line: 277	
		Operand.optimize(ExpressionVisitor, ContextItemStaticInfo) line: 200	
		LetExpression.optimize(ExpressionVisitor, ContextItemStaticInfo) line: 277	
		FLWORExpression.rewriteForOrLet(ExpressionVisitor, ContextItemStaticInfo) line: 759	
		FLWORExpression.optimize(ExpressionVisitor, ContextItemStaticInfo) line: 577	
		XQueryFunction.optimize() line: 430	
		XQueryFunctionLibrary.optimizeGlobalFunctions() line: 328	
		QueryModule.optimizeGlobalFunctions() line: 1200	
		Executable.fixupQueryModules(QueryModule, boolean) line: 574	
		XQueryParserEE(XQueryParser).makeXQueryExpression(String, QueryModule, Configuration) line: 161	
		StaticQueryContextEE(StaticQueryContext).compileQuery(String) line: 589	
		StaticQueryContextEE(StaticQueryContext).compileQuery(InputStream, String) line: 652	
		XQueryCompiler.compile(InputStream) line: 606	
		Query.compileQuery(XQueryCompiler, String, boolean) line: 794	
		Query.doQuery(String[], String) line: 342	
		Query.main(String[]) line: 111	

Files

JavaParser.xquery (677 KB) JavaParser.xquery Gunther Rademacher, 2015-12-20 22:33
Actions #1

Updated by Michael Kay almost 9 years ago

The "bad parent pointer" messages can usually be ignored, unless something else fails later on. I actually meant to remove the message before we released, but somehow that got overlooked.

In 9.7 we have added parent pointers to the expression tree, which make it easier to handle the static context in which an expression appears. These have to be maintained through tree rewrites, and there's an audit at the end of optimisation to check that the tree is consistent. Since an inconsistency could indicate a more serious problem, we are interested in investigating them, though we knew there were a few instances left at the point we released that appeared to cause no trouble.

Actions #2

Updated by Michael Kay almost 9 years ago

  • Category set to Internals
  • Status changed from New to Resolved
  • Assignee set to Michael Kay
  • Fix Committed on Branch 9.7 added

This appears to have been fixed by virtue of the changes made in response to bug #2556.

Actions #3

Updated by O'Neil Delpratt almost 9 years ago

  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 9.7.0.2 added

Bug fix applied in the Saxon 9.7.0.2 maintenance release

Actions #4

Updated by O'Neil Delpratt almost 9 years ago

  • Status changed from Resolved to Closed

Please register to edit this issue

Also available in: Atom PDF