zspitzer / lucee-performance-analyzer

Performance Analyzer plugin for Lucee, to be used in the Lucee Admin or Standalone.
GNU Lesser General Public License v2.1
34 stars 4 forks source link

SQL exception when opening "Templates" from within the server admin page #4

Closed andreasRu closed 3 years ago

andreasRu commented 3 years ago

The plug-in is causing an SQL exception when opening "Templates" from within the server admin page. The error doesn't show up when same section is called from the localhost web-context. The error is:

Unexpected token in statement [select id, count as ]

error occurred in /opt/lucee/tomcat/lucee-server/context/context/admin/plugin/PerformanceAnalyzer/templates.cfm:43 called by /var/www/html/WEB-INF/lucee/context/admin/plugin/Plugin.cfc:82 called by /opt/lucee/tomcat/lucee-server/context/context/admin/plugin/PerformanceAnalyzer/Action.cfc:39 called by /admin/plugin.cfm:78 called by /admin/web.cfm:492 called by /admin/server.cfm:2

Plugin: lucee-performance-analyzer 1.0.2.2 Installation Way: Installed the plugin within the server administrator (not web administrator) Version Lucee 5.3.8.139-RC Version Name Gelert Release date Jan 22, 2021 Servlet Container Apache Tomcat/9.0.40 Java 11.0.4 (AdoptOpenJDK) 64bit Host Name localhost OS Linux (5.4.0-67-generic) 64bit

Please see a screenshot for further information: image

zspitzer commented 3 years ago

That's quite odd!

That simple query was to just to make it hsqldb safe, I wonder why it's falling back to hsqldb.

https://github.com/lucee/Lucee/pull/1211

The fix is just to wrap count in double quotes. Actually that extra query can be eliminated, but I'm curious why the simple QoQ is failing only under the server context? The only thing which is different is the debug log datasource. Thoughts @bdw429s?

Where is debugging enabled? Server / Web or both?

zspitzer commented 3 years ago

disabling QoQ, -Dlucee.qoq.hsqldb.disable=true

reveals key [id] not found in query, columns are [empty]

https://github.com/lucee/Lucee/blob/5.3/core/src/main/java/lucee/runtime/db/QoQ.java#L239

lucee.runtime.exp.DatabaseException: key [id] not found in query, columns are [empty] at lucee.runtime.type.QueryImpl.getColumn(QueryImpl.java:1323) at lucee.runtime.db.QoQ.executeSingle(QoQ.java:239) at lucee.runtime.db.QoQ.execute(QoQ.java:123) at lucee.runtime.db.HSQLDBHandler.execute(HSQLDBHandler.java:258) at lucee.runtime.tag.Query.executeQoQ(Query.java:1110) at lucee.runtime.tag.Query._doEndTag(Query.java:680) at lucee.runtime.tag.Query.doEndTag(Query.java:565) at performanceanalyzer.templates_cfm$cf$aq.call(/lucee_plugin_directory/PerformanceAnalyzer/templates.cfm:46)