Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-98712

Adding a long User Object Filter in a User Directory configuration results in "System Error"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 8.5.14
    • User - Management
    • None

      Issue Summary

      This is reproducible on Data Center: yes

      There is a default character limit of 4000 for column attribute_value on table cwd_directory_attribute which is not big enough for some use cases.

      Steps to Reproduce

      1. Create a User Directory in Confluence
      2. Under User Schema Settings, enter a User Object Filter string longer than 4000 characters
      3. Click Save and Test

      Expected Results

      The User Directory configuration is saved without any error.

      Actual Results

      The following error message is shown:

      Oops - and error has occurred

      System Error

      Referer URL: https://<confluence-base-url>/plugins/servlet/embedded-crowd/configure/ldap/?directoryId=xxxx

      The following error is shown in the logs:

      atlassian-confluence.log
      2024-10-14 08:44:50,023 ERROR [https-jsse-nio2-443-exec-3] [atlassian.plugin.servlet.ServletModuleContainerServlet] service Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
       -- url: /plugins/servlet/embedded-crowd/configure/ldap/ | userName: localadmin | referer: https://<confluence-base-url>/plugins/servlet/embedded-crowd/configure/ldap/?directoryId=xxxx | traceId: 31d215599332f95e
      org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
      ...
      Caused by: org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement
      ...
      Caused by: org.hibernate.exception.DataException: could not execute statement
      ...
      Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated.
      	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.executeUpdate(SQLServerPreparedStatement.java:473)
      	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61)
      	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java)
      	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197)
      	... 435 more
      

      Running SQL query:

      SELECT column_name, data_type, character_maximum_length FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'cwd_directory_attribute';
      

      Shows a limit of 4000 characters for column _attribute_value on table cwd_directory_attribute:

      column_name        data_type    character_maximum_length
      directory_id       numeric      NULL
      attribute_name     nvarchar     255
      attribute_value    nvarchar     4000

      Workaround

      Remove the 4000 characters limit with this SQL:

      ALTER TABLE cwd_directory_attribute ALTER COLUMN attribute_value nvarchar (max);
      

      Linked KB: Adding a long User Object Filter in a User Directory configuration results in "System Error"

        1. image-2024-11-29-09-22-16-868.png
          67 kB
          Gabriel Piedade
        2. System Error.png
          421 kB
          Gabriel Piedade

              Unassigned Unassigned
              b509bc5d0980 Gabriel Piedade
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: