Details
-
Bug
-
Resolution: Fixed
-
High
-
7.14.4, 7.19.5, 8.1.0, 8.0.2, 7.13.15
-
1
-
Severity 2 - Major
-
Description
Issue Summary
This is reproducible on Data Center: yes
The application is not able to load diagnostics details using http[s]://<confluence-host>/plugins/servlet/diagnostics/overview page.
Environment
Confluence versions : 7.19+
Microsoft SQL Server 2019 and 2017
The issue is not present when Confluence is used with PostgreSQL database.
Steps to Reproduce
- Access http[s]://<confluence-host>/plugins/servlet/diagnostics/overview URL from the broswer
- Then click on View Details link for any one of the alerts listed under Confluence Diagnostics
Expected Results
The diagnostic details should load and show more information about the alert.
Actual Results
The below exception is thrown in the xxxxxxx.log file:
2023-02-16 15:25:24,083 WARN [http-nio-8090-exec-5] [engine.jdbc.spi.SqlExceptionHelper] logExceptions SQL Error: 8116, SQLState: S0001 -- url: /rest/diagnostics/latest/alerts/details/JVM-1002/not-detected | userName: admin | referer: http://localhost:8090/plugins/servlet/diagnostics/details/JVM-1002/not-detected | traceId: 436ef5c610faba8e 2023-02-16 15:25:24,083 ERROR [http-nio-8090-exec-5] [engine.jdbc.spi.SqlExceptionHelper] logExceptions Argument data type ntext is invalid for argument 1 of len function. -- url: /rest/diagnostics/latest/alerts/details/JVM-1002/not-detected | userName: admin | referer: http://localhost:8090/plugins/servlet/diagnostics/details/JVM-1002/not-detected | traceId: 436ef5c610faba8e ....... 2023-02-16 15:25:24,104 ERROR [http-nio-8090-exec-5] [[Standalone].[localhost].[/].[noop]] log Servlet.service() for servlet [noop] in context with path [] threw exception org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:195) at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:370) at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:334) at com.atlassian.confluence.internal.diagnostics.persistence.dao.hibernate.HibernateAlertEntityDao.withSession(HibernateAlertEntityDao.java:304) at com.atlassian.confluence.internal.diagnostics.persistence.dao.hibernate.HibernateAlertEntityDao.streamMinimalAlerts(HibernateAlertEntityDao.java:222) ..... Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Argument data type ntext is invalid for argument 1 of len function. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1624) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:594) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:524) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2979) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:248) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:223) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:446) at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52) at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:57) ... 388 more
The SQL debug logging shows below SQL query failing to pull the data from the DIAGNOSTICS_ALERTS table.
2023-02-16 14:48:33,876 DEBUG [http-nio-8090-exec-4] [org.hibernate.SQL] logStatement select alertentit0_.id as col_0_0_, alertentit0_.TIMESTAMP as col_1_0_, alertentit0_.ISSUE_ID as col_2_0_, alertentit0_.TRIGGER_PLUGIN_KEY as col_3_0_, alertentit0_.NODE_NAME as col_4_0_, case when alertentit0_.DETAILS_JSON is null then 0 else len(alertentit0_.DETAILS_JSON) end as col_5_0_ from DIAGNOSTICS_ALERTS alertentit0_ where (alertentit0_.ISSUE_ID in (?)) and (alertentit0_.TRIGGER_PLUGIN_KEY_LOWER in (?)) and alertentit0_.TIMESTAMP>0 and alertentit0_.TIMESTAMP<=1676558913847 order by alertentit0_.TIMESTAMP desc, alertentit0_.id desc 2023-02-16 14:48:33,877 TRACE [http-nio-8090-exec-4] [type.descriptor.sql.BasicBinder] bind binding parameter [1] as [VARCHAR] - [JVM-1002] 2023-02-16 14:48:33,878 TRACE [http-nio-8090-exec-4] [type.descriptor.sql.BasicBinder] bind binding parameter [2] as [VARCHAR] - [not-detected]
It looks the application is passing the wrong data type (ntext) to a function – in this case, the len() function.
Workaround
Currently there is no known workaround for this behavior. A workaround will be added here when available
Attachments
Issue Links
- relates to
-
CONFSERVER-79783 Adjust MS SQL datatypes for future releases
- Gathering Interest