We have a couple of apps that we are looking to move to Lucee from Adobe ColdFusion. They deal with lots of incoming XML and we have schemas that incoming XML must be validated against. We’ve run into something that makes no sense: calling function xmlParse() with a schema (either a file reference or a string containing the schema) causes the Lucee server and web admin UI’s to break and remain broken until we stop and restart the Tomcat instance Lucee is running on. It’s very repeatable, using the following code:
<cfscript>
// XML:
savecontent variable='x' {
writeOutput('<?xml version="1.0" encoding="UTF-8" ?>
<ac:application
xmlns:ac="https://foo.org/test"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://foo.org/test test.xsd"
>
<settings>
<setting name="goo" type="boolean">false</setting>
</settings>
</ac:application>
');
}
// Schema:
savecontent variable='s' {
writeOutput('<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema
targetNamespace="https://foo.org/test"
xmlns:ac="https://foo.org/test"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:element name="application" type="ac:Application" />
<xs:complexType name="Application">
<xs:sequence>
<xs:element name="settings" type="ac:Settings" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="Settings">
<xs:sequence>
<xs:element name="setting" type="ac:Setting" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="Setting">
<xs:simpleContent>
<xs:extension base="xs:normalizedString">
<xs:attribute name="name" type="xs:token" />
<xs:attribute name="type" type="ac:SettingType" default="string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="SettingType">
<xs:restriction base="xs:token">
<xs:enumeration value="string" />
<xs:enumeration value="boolean" />
<xs:enumeration value="integer" />
<xs:enumeration value="numeric" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
');
}
d = xmlParse(x, true, s);
writeDump(var = d, label = 'd', expand = false);
</cfscript>
To reproduce the behavior:
- Start Lucee
- Sign into Lucee’s admin API and go to the “Overview” page. Note that the dynamically-generated charts are updating.
- In another browser tab/window, run the above script… but keep an eye on the dynamically updating charts. Note that the script dumps the XML document structure.
- Note that, as soon as the script runs, the dynamically updating charts stop updating.
- In the Lucee admin, try to go to any other page within the admin. You’ll get redirected to the admin’s sign-in page.
- When you attempt to sign in, Lucee throws an exception.
The Lucee admin will remain broken until we stop and restart the Tomcat instance. We can’t find anything in any of the Lucee or Tomcat logs that details the breakage (except the exception captured in the screenshot, which is from trying to go to a different page within the admin UI or trying to sign back in, and thus well after the admin UI breaks and the charts stop updating). Inspecting the traffic behind the dynamic charts, each AJAX request is returning the Lucee admin sign-in page.
Is this a known problem with xmlParse() and Lucee? We’ve verified this behavior on two different dev servers running 5.3.2.77. The logic behaves as expected under ACF on these same two systems. The behavior is specific to calling xmlParse() with the third argument present (calling it without a schema has no unexpected side effects on the Lucee admin) and calling it with a path to a schema, the URL for the schema, or the schema passed in as a string all behave the same. Changing the second argument for case-sensitivity has no impact on the noted behavior.
Any help troubleshooting this (or confirmation that this is in fact an issue with Lucee) would be most welcome.