Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-17622

Integrity constraint violation error when changing Notifications Applications Preferences

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 12.6
    • Fix Version/s: 12.6.1, 12.7-rc-1
    • Component/s: Notifications
    • Labels:
    • Environment:
      Windows 10 Pro 64 bit, Firefox 79, using a local instance of XWiki 12.6 on HSQLDB, Jetty
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      Description

      STEPS TO REPRODUCE

      1. Start a fresh XWiki instance
      2. Login
      3. Go to Notifications Settings
      4. Under Applications, turn Pages toggles ON/OFF (for email or Notification menu)

      EXPECTED RESULTS

      The preference change is saved without any errors.

      ACTUAL RESULTS

      In console there are some SQL errors. Partial stacktrace:

      2020-08-10 12:09:29,040 [qtp1671846437-204 - http://localhost:1260/xwiki/bin/get/XWiki/Notifications/Code/NotificationPreferenceService?outputSyntax=plain] WARN  o.h.e.j.s.SqlExceptionHelper   - SQL Error: -104, SQLState: 23505
      2020-08-10 12:09:29,041 [qtp1671846437-204 - http://localhost:1260/xwiki/bin/get/XWiki/Notifications/Code/NotificationPreferenceService?outputSyntax=plain] ERROR o.h.e.j.s.SqlExceptionHelper   - integrity constraint violation: unique constraint or index violation; SYS_PK_10315 table: XWIKIRCS
      2020-08-10 12:09:29.097:WARN:oejsh.ErrorHandler:qtp1671846437-204: Error page too large: 500 org.apache.velocity.exception.MethodInvocationException: Invocation of method 'saveNotificationPreferences' in  class org.xwiki.notifications.preferences.script.NotificationPreferenceScriptService threw exception org.xwiki.notifications.NotificationException: Failed to save preferences for notifications given as JSON. at xwiki:XWiki.Notifications.Code.NotificationPreferenceService[line 25, column 36]
              at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:306)
              at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:233)
              at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:369)
              at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:490)
              at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:144)
              at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:423)
              at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:191)
              at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:144)
              at org.xwiki.velocity.internal.directive.TryCatchDirective.render(TryCatchDirective.java:86)
              at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:301)
              at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:144)
              at org.apache.velocity.runtime.parser.node.ASTElseIfStatement.render(ASTElseIfStatement.java:104)
              at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:191)
              at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:423)
              at org.apache.velocity.Template.merge(Template.java:358)
              at org.apache.velocity.Template.merge(Template.java:262)
              at org.xwiki.velocity.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:281)
              at com.xpn.xwiki.render.DefaultVelocityManager.evaluate(DefaultVelocityManager.java:316)
              at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:131)
              at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:52)
              at org.xwiki.rendering.macro.script.AbstractScriptMacro.evaluateBlock(AbstractScriptMacro.java:286)
              at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:182)
              at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:58)
              at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:297)
              at org.xwiki.rendering.internal.transformation.DefaultRenderingContext.transformInContext(DefaultRenderingContext.java:183)
              at org.xwiki.rendering.internal.transformation.DefaultTransformationManager.performTransformations(DefaultTransformationManager.java:101)
              at org.xwiki.display.internal.DocumentContentAsyncExecutor.executeInCurrentExecutionContext(DocumentContentAsyncExecutor.java:348)
              at org.xwiki.display.internal.DocumentContentAsyncExecutor.execute(DocumentContentAsyncExecutor.java:221)
              at org.xwiki.display.internal.DocumentContentAsyncRenderer.execute(DocumentContentAsyncRenderer.java:107)
              at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.render(AbstractBlockAsyncRenderer.java:157)
              at org.xwiki.rendering.async.internal.block.AbstractBlockAsyncRenderer.render(AbstractBlockAsyncRenderer.java:54)
              at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.syncRender(DefaultAsyncRendererExecutor.java:273)
              at org.xwiki.rendering.async.internal.DefaultAsyncRendererExecutor.render(DefaultAsyncRendererExecutor.java:250)
              at org.xwiki.rendering.async.internal.block.DefaultBlockAsyncRendererExecutor.execute(DefaultBlockAsyncRendererExecutor.java:125)
              at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:67)
              at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:43)
              at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:96)
              at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:39)
              at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:123)
              at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:52)
              at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:68)
              at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:42)
              at com.xpn.xwiki.doc.XWikiDocument.display(XWikiDocument.java:1215)
              at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:1356)
              at com.xpn.xwiki.doc.XWikiDocument.displayDocument(XWikiDocument.java:1305)
              at com.xpn.xwiki.api.Document.displayDocument(Document.java:765)
              at jdk.internal.reflect.GeneratedMethodAccessor386.invoke(Unknown Source)
              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.base/java.lang.reflect.Method.invoke(Method.java:566)

      Full stacktrace available at https://up1.xwikisas.com/#Jh4G4n5k9Rz99A21NIVoxA.

      The toggle preferences seems to be saved though, the users get notifications events.

      The issue could not be reproduced on XWiki 12.5.1.

        Attachments

          Activity

            People

            • Assignee:
              surli Simon Urli
              Reporter:
              iandriuta Ilie Andriuta
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response: