Bug #3195
closedDuplicate binding slot assignment
100%
Description
One of our users reported this problem when publishing DITA to PDF using their own XSLT customizations which may not be properly constructed. The problem cannot be reproduced with an older Saxon library.
When I obtain some sample XSLT code from them I will try to add more details to the issue:
https://www.oxygenxml.com/forum/viewtopic.php?f=20&t=14355&p=42301#p42295
Duplicate binding slot assignment
at net.sf.saxon.expr.GlobalVariableReference.setBindingSlot(GlobalVariableReference.java:60)
at net.sf.saxon.expr.instruct.ComponentCode.processComponentReference(ComponentCode.java:140)
at net.sf.saxon.expr.instruct.ComponentCode.allocateBindingSlotsRecursive(ComponentCode.java:106)
at net.sf.saxon.expr.instruct.ComponentCode.allocateBindingSlotsRecursive(ComponentCode.java:109)
at net.sf.saxon.expr.instruct.ComponentCode.allocateBindingSlotsRecursive(ComponentCode.java:109)
at net.sf.saxon.expr.instruct.ComponentCode.allocateBindingSlotsRecursive(ComponentCode.java:109)
at net.sf.saxon.expr.instruct.ComponentCode.allocateBindingSlotsRecursive(ComponentCode.java:109)
at net.sf.saxon.expr.instruct.ComponentCode.allocateBindingSlotsRecursive(ComponentCode.java:109)
at net.sf.saxon.expr.instruct.ComponentCode.allocateBindingSlotsRecursive(ComponentCode.java:109)
at net.sf.saxon.expr.instruct.ComponentCode.allocateBindingSlotsRecursive(ComponentCode.java:109)
at net.sf.saxon.expr.instruct.ComponentCode.allocateBindingSlotsRecursive(ComponentCode.java:109)
at net.sf.saxon.expr.instruct.ComponentCode.allocateBindingSlotsRecursive(ComponentCode.java:109)
at net.sf.saxon.expr.instruct.ComponentCode.allocateBindingSlotsRecursive(ComponentCode.java:109)
at net.sf.saxon.expr.instruct.ComponentCode.allocateBindingSlotsRecursive(ComponentCode.java:109)
at net.sf.saxon.expr.instruct.ComponentCode.allocateAllBindingSlots(ComponentCode.java:100)
at net.sf.saxon.style.PrincipalStylesheetModule.compile(Unknown Source)
at net.sf.saxon.style.Compilation.compilePackage(Compilation.java:265)
at net.sf.saxon.style.StylesheetModule.loadStylesheet(StylesheetModule.java:260)
at net.sf.saxon.style.Compilation.compileSingletonPackage(Compilation.java:101)
at net.sf.saxon.s9api.XsltCompiler.compile(XsltCompiler.java:859)
at net.sf.saxon.jaxp.SaxonTransformerFactory.newTemplates(Unknown Source)
at org.apache.tools.ant.taskdefs.optional.TraXLiaison.readTemplates(TraXLiaison.java:310)
at org.apache.tools.ant.taskdefs.optional.TraXLiaison.createTransformer(TraXLiaison.java:328)
at org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:188)
at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:881)
at org.apache.tools.ant.taskdefs.XSLTProcess.execute(XSLTProcess.java:419)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.Main.runBuild(Main.java:857)
at org.apache.tools.ant.Main.startAnt(Main.java:236)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:113)
Updated by Michael Kay about 7 years ago
Never seen that particular symptom before, except during development. It probably means that the same variable reference is reachable by more than one route in the expression tree, which means that some rewrite process has failed to observe the protocol of always making a copy. Will need a repro to resolve it.
Updated by Radu Coravu about 7 years ago
I got the samples from my end user, they are a DITA Open Toolkit 1.8.5 PDF customization plugin containing a bunch of XSLT stylesheets being imported with high priority in the XSLT stylesheets from the DITA OT base PDF plugin.
One of those stylesheets defines a variable like this:
<xsl:variable name="column.set">2</xsl:variable>
and then uses it a little further down like this:
<xsl:attribute-set name="column.two">
<xsl:attribute name="column-count">
<xsl:value-of select="$column.set"/>
</xsl:attribute>
</xsl:attribute-set>
I removed all references to that "column.two" attribute set (it was referenced in other attribute sets) but the error still occurs so somehow that reference to $column.set from the attribute set generates the problem.
Updated by Michael Kay about 7 years ago
The fact that the variable reference is within an attribute set certainly provides a very significant clue. However, I haven't been able to reproduce the problem, or to see anything wrong by code inspection, so there must be some other factor at play.
Do you know whether there is only one attribute set declaration with this name?
Under the failure conditions, what references to the attribute set exist?
Are there any references to the global variable other than the reference in the attribute set?
Updated by Michael Kay about 7 years ago
My suspicions are falling on PrincipalStylesheetModule.combineAttributeSets()
which creates an AttributeSet
from all the xsl:attribute-set
declarations that share the same name. If somehow a single xsl:attribute-set
were present in this list more than once, then the variable reference would be processed more than once, leading to the observed effect. I'm wondering if this could happen through multiple includes/imports of a stylesheet module?
OK: I've reproduced it by declaring the attribute-set in a module and doing two xsl:includes on that module:
Warning at xsl:stylesheet on line 5 column 17 of test1.xsl:
Stylesheet module file:/Users/mike/Desktop/temp/test1.xsl is included or imported more
than once. This is permitted, but may lead to errors or unexpected behavior
Exception in thread "main" java.lang.AssertionError: Duplicate binding slot assignment
The warning is pertinent!
Updated by Michael Kay about 7 years ago
- Status changed from New to Resolved
- Applies to branch 9.7, 9.8 added
- Fix Committed on Branch 9.7, 9.8 added
Produced a patch to combineAttributeSets() to ensure that if two instances of the same xsl:attribute-set are present, only the last is retained.
Added W3C test case attribute-set-1815.
Updated by Radu Coravu about 7 years ago
Your analysis is 100% correct, the XSLT stylesheet was included from two places. And you also saved me 30 minutes of trying to put together a set of sample stylesheets.
I will try to include the patch in the next Oxygen 19.0 minor bug fix release.
We also got a StackOverflowException reported:
https://www.oxygenxml.com/forum/viewtopic.php?f=1&t=14382&p=42408#p42408
but that's another story, I will add a separate issue for it...
Updated by O'Neil Delpratt almost 7 years ago
- Fix Committed on Branch trunk added
- Fix Committed on Branch deleted (
9.8)
Updated by O'Neil Delpratt almost 7 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.7.0.19 added
Bug fix applied in the 9.7.0.19 maintenance release.
Please register to edit this issue