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

Integrity constraint violation error when changing Notifications Applications Preferences

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 12.6.1, 12.7-rc-1
    • 12.6
    • Notifications
    • Windows 10 Pro 64 bit, Firefox 79, using a local instance of XWiki 12.6 on HSQLDB, Jetty
    • Unknown
    • N/A
    • N/A

    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

        1. Failed_to_save_settings.png
          57 kB
          Ilie Andriuta
        2. Full stacktrace.txt
          67 kB
          Ilie Andriuta

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: