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

Reconcile Unknown Attachments plugin is incompatible with Confiforms macro

      Issue Summary

      https://jira.atlassian.com/browse/CONFSERVER-25507?focusedCommentId=2802070&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-2802070

      https://jira.atlassian.com/browse/CONFSERVER-63615?focusedCommentId=2823911&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-2823911

       

      Steps to Reproduce

      1. Install both plugins
      2. View a page with a confiforms macro

      Expected Results

      macro renders

      Actual Results

      An error is rendered

      Workaround

      Uninstall reconcile unknown attachments plugin

            [CONFSERVER-66518] Reconcile Unknown Attachments plugin is incompatible with Confiforms macro

            A fix for this issue is available in Confluence Server and Data Center 8.0.3.
            Upgrade now or check out the Release Notes to see what other issues are resolved.

            odykovy (Inactive) added a comment - A fix for this issue is available in Confluence Server and Data Center 8.0.3. Upgrade now or check out the Release Notes to see what other issues are resolved.

            Hi Alex

            This is extremely helpful, thank you

            We will also make sure we dont convert to storage format if that really is a storage format. I think that was done to make sure the (macro) preview works, as this is when the contents that is given is not in storage format

            You have unblocked a significant amount of (our and yours) customers to migrate to Confluence 8

            Thanks again
            Alex

            Alex Medved {ConfiForms} added a comment - Hi Alex This is extremely helpful, thank you We will also make sure we dont convert to storage format if that really is a storage format. I think that was done to make sure the (macro) preview works, as this is when the contents that is given is not in storage format You have unblocked a significant amount of (our and yours) customers to migrate to Confluence 8 Thanks again Alex

            6dfd011db329, here is the status update of the issue.

            Root cause:
            The ConfiForm macro tries to convert its own XHTML fragment to storage format even though it is already in storage format.

            Details:

            1. Confluence renders a page for view.
            2. Confluence calls com.atlassian.confluence.macro.Macro#execute for each macro on the page.
            3. ConfiForm macro implements this method and somewhere inside implementation calls com.atlassian.confluence.content.render.xhtml.FormatConverter#convertToStorageFormat with incorrect first argument, which is already in storage format. This is where the bug happens.
            4. The confluence-unknown-attachments-reconciliation-plugin installs format transformers: storageToView, storageToEditor, editorToStorage. (The plugin handles representation of unknown attachments in various formats.)
            5. The plugin tries to use editorToStorage transformer on input in storage format. The transformer's XML reader fails to parse the input and throws an exception. Older version of XML parser used to throw com.ctc.wstx.exc.WstxLazyException; new version throws com.ctc.wstx.exc.WstxParsingException.

            In the past we introduced a patch inside confluence-unknown-attachments-reconciliation-plugin by converting WstxLazyException to com.atlassian.confluence.content.render.xhtml.XhtmlException. It seems that ConfiForm macro can handle XhtmlException and somehow recover from it.

            After upgrading XML parsing library in Confluence 8.0, the patch does not work since the exception type changed.

            Solution:

            • I'm going to harden the confluence-unknown-attachments-reconciliation-plugin: when its transformers fail parsing given XHTML input, then they will throw XhtmlException only.
            • At the same time you should fix the ConfiForms macro and stop calling FormatConverter#convertToStorageFormat with an input that is already in storage format.

            I attached a thread dump of the process where you can see the call stack. The thread name is "http-nio-1990-exec-6@54925".
            For your convenience I'm inserting relevant part of the call stack in this comment, as well.

            Stack trace
            "http-nio-1990-exec-6@54925" daemon prio=5 tid=0x15f nid=NA runnable
              java.lang.Thread.State: RUNNABLE
            	  at com.atlassian.confluence.plugins.attachment.reconciliation.marshalling.UnknownAttachmentTransformerBase.transform(UnknownAttachmentTransformerBase.java:61)
            	  at com.atlassian.confluence.plugins.attachment.reconciliation.marshalling.UnknownAttachmentTransformerEditorToStorage.transform(UnknownAttachmentTransformerEditorToStorage.java:30)
            	  at com.atlassian.confluence.content.render.xhtml.TransformerChain.transform(TransformerChain.java:33)
            	  at com.atlassian.confluence.content.render.xhtml.PluggableTransformerChain.transform(PluggableTransformerChain.java:39)
            	  at com.atlassian.confluence.content.render.xhtml.editor.DefaultEditorConverter.convert(DefaultEditorConverter.java:37)
            	  at com.atlassian.confluence.content.render.xhtml.DefaultFormatConverter.convertToStorageFormat(DefaultFormatConverter.java:123)
            	  [...]
            	  at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
            	  at com.sun.proxy.$Proxy565.convertToStorageFormat(Unknown Source:-1)
            	  [...]
            	  at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(HostComponentFactoryBean.java:130)
            	  at com.sun.proxy.$Proxy565.convertToStorageFormat(Unknown Source:-1)
            	  at com.vertuna.confluence.plugins.confiforms.action.BaseAction.tryToGetBody(BaseAction.java:963)
            	  at com.vertuna.confluence.plugins.confiforms.action.BaseAction.getConfiFormsPage(BaseAction.java:827)
            	  at com.vertuna.confluence.plugins.confiforms.AbstractConfiFormMacro.getConfiFormsPage(AbstractConfiFormMacro.java:197)
            	  at com.vertuna.confluence.plugins.confiforms.ConfiFormMacro.executeToStream(ConfiFormMacro.java:65)
            	  [...]
            	  at com.atlassian.confluence.pages.actions.ViewPageAction.execute(ViewPageAction.java:177)
            	  [...]
            

            Thread dump: threads_report.txt

            Alex Blekhman (Inactive) added a comment - 6dfd011db329 , here is the status update of the issue. Root cause: The ConfiForm macro tries to convert its own XHTML fragment to storage format even though it is already in storage format. Details: Confluence renders a page for view. Confluence calls com.atlassian.confluence.macro.Macro#execute for each macro on the page. ConfiForm macro implements this method and somewhere inside implementation calls com.atlassian.confluence.content.render.xhtml.FormatConverter#convertToStorageFormat with incorrect first argument, which is already in storage format. This is where the bug happens. The confluence-unknown-attachments-reconciliation-plugin installs format transformers: storageToView , storageToEditor , editorToStorage . (The plugin handles representation of unknown attachments in various formats.) The plugin tries to use editorToStorage transformer on input in storage format. The transformer's XML reader fails to parse the input and throws an exception. Older version of XML parser used to throw com.ctc.wstx.exc.WstxLazyException ; new version throws com.ctc.wstx.exc.WstxParsingException . In the past we introduced a patch inside confluence-unknown-attachments-reconciliation-plugin by converting WstxLazyException to com.atlassian.confluence.content.render.xhtml.XhtmlException . It seems that ConfiForm macro can handle XhtmlException and somehow recover from it. After upgrading XML parsing library in Confluence 8.0, the patch does not work since the exception type changed. Solution: I'm going to harden the confluence-unknown-attachments-reconciliation-plugin : when its transformers fail parsing given XHTML input, then they will throw XhtmlException only. At the same time you should fix the ConfiForms macro and stop calling FormatConverter#convertToStorageFormat with an input that is already in storage format. I attached a thread dump of the process where you can see the call stack. The thread name is "http-nio-1990-exec-6@54925". For your convenience I'm inserting relevant part of the call stack in this comment, as well. Stack trace "http-nio-1990-exec-6@54925" daemon prio=5 tid=0x15f nid=NA runnable java.lang. Thread .State: RUNNABLE at com.atlassian.confluence.plugins.attachment.reconciliation.marshalling.UnknownAttachmentTransformerBase.transform(UnknownAttachmentTransformerBase.java:61) at com.atlassian.confluence.plugins.attachment.reconciliation.marshalling.UnknownAttachmentTransformerEditorToStorage.transform(UnknownAttachmentTransformerEditorToStorage.java:30) at com.atlassian.confluence.content.render.xhtml.TransformerChain.transform(TransformerChain.java:33) at com.atlassian.confluence.content.render.xhtml.PluggableTransformerChain.transform(PluggableTransformerChain.java:39) at com.atlassian.confluence.content.render.xhtml.editor.DefaultEditorConverter.convert(DefaultEditorConverter.java:37) at com.atlassian.confluence.content.render.xhtml.DefaultFormatConverter.convertToStorageFormat(DefaultFormatConverter.java:123) [...] at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26) at com.sun.proxy.$Proxy565.convertToStorageFormat(Unknown Source:-1) [...] at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(HostComponentFactoryBean.java:130) at com.sun.proxy.$Proxy565.convertToStorageFormat(Unknown Source:-1) at com.vertuna.confluence.plugins.confiforms.action.BaseAction.tryToGetBody(BaseAction.java:963) at com.vertuna.confluence.plugins.confiforms.action.BaseAction.getConfiFormsPage(BaseAction.java:827) at com.vertuna.confluence.plugins.confiforms.AbstractConfiFormMacro.getConfiFormsPage(AbstractConfiFormMacro.java:197) at com.vertuna.confluence.plugins.confiforms.ConfiFormMacro.executeToStream(ConfiFormMacro.java:65) [...] at com.atlassian.confluence.pages.actions.ViewPageAction.execute(ViewPageAction.java:177) [...] Thread dump: threads_report.txt

            6dfd011db329, thank you for the link to confiforms-3.0.0-RC3.obr file. I tried it with Confluence 8.0.2 and I confirm that the problem is there. I reopened the ticket. We're working on the fix.
            I apologise for miscommunication.
            Thank you for the bug report.

            Alex Blekhman (Inactive) added a comment - 6dfd011db329 , thank you for the link to confiforms-3.0.0-RC3.obr file. I tried it with Confluence 8.0.2 and I confirm that the problem is there. I reopened the ticket. We're working on the fix. I apologise for miscommunication. Thank you for the bug report.

            Hi Alex

            This issue is currently a blocker for us to release a ConfiForms version compatible with Confluence 8.0.2+ (8.0.1 and 8.0.0 had a even more critical issue that is now fixed)

            Anyway, you can download Confluence 8 compatible version from our wiki or from a corresponding ECOHELP ticket

            Alex

            Alex Medved {ConfiForms} added a comment - Hi Alex This issue is currently a blocker for us to release a ConfiForms version compatible with Confluence 8.0.2 + (8.0.1 and 8.0.0 had a even more critical issue that is now fixed) Anyway, you can download Confluence 8 compatible version from our wiki or from a corresponding ECOHELP ticket Alex

            I believe the ConfiForms plugin is not compatible with Confluence 8.x. It is because the plugin is using outdated third party library: XWorks 1.x. See more info here:

            Once I tried the plugin with Confluence 8.x I could see in the logfile java.lang.ClassNotFoundException exception for missing com/opensymphony/webwork/ServletActionContext and other XWorks related classes. The plugin needs to upgrade to use the new version of Struts.

            Alex Blekhman (Inactive) added a comment - - edited I believe the ConfiForms plugin is not compatible with Confluence 8.x. It is because the plugin is using outdated third party library: XWorks 1.x. See more info here: Struts 2 upgrade PSA - Confluence moves to Struts in 8.0 - EAP Once I tried the plugin with Confluence 8.x I could see in the logfile java.lang.ClassNotFoundException exception for missing com/opensymphony/webwork/ServletActionContext and other XWorks related classes. The plugin needs to upgrade to use the new version of Struts.

            To resolve CVEs we must upgrade to 8.0.2, but only to find that we can't.  Three of plug-in vendor don't yet have plug-ins that can support confluence 8.0.2 and it appears that this defect is one of their blockers.  

            Please resolve!!

            Sandi Ameen added a comment - To resolve CVEs we must upgrade to 8.0.2, but only to find that we can't.  Three of plug-in vendor don't yet have plug-ins that can support confluence 8.0.2 and it appears that this defect is one of their blockers.   Please resolve!!

            Hi,

            I have reopen this ticket, becasue the error appeared in Confluence 8.0 and Confluence Unknown Attachment Reconcilitation Plugin 2.0.

            I can reproduce this case and confirm that it received the same error message that was reported earlier.

            Error rendering macro 'confiform'
            com.ctc.wstx.exc.WstxParsingException: Undeclared namespace prefix "ac" at [row,col {unknown-source}]: [1,189] 
            
            Error rendering macro 'confiform-entry-register'
            com.ctc.wstx.exc.WstxParsingException: Undeclared namespace prefix "ac" at [row,col {unknown-source}]: [1,189]

            Tested: docker instances, confluence 8.0, Postgres 14.6, openjdk version "11.0.17" 2022-10-18.

            Mirek Sztuba (Inactive) added a comment - Hi, I have reopen this ticket, becasue the error appeared in Confluence 8.0 and Confluence Unknown Attachment Reconcilitation Plugin 2.0. I can reproduce this case and confirm that it received the same error message that was reported earlier. Error rendering macro 'confiform' com.ctc.wstx.exc.WstxParsingException: Undeclared namespace prefix "ac" at [row,col {unknown-source}]: [1,189] Error rendering macro 'confiform-entry-register' com.ctc.wstx.exc.WstxParsingException: Undeclared namespace prefix "ac" at [row,col {unknown-source}]: [1,189] Tested: docker instances, confluence 8.0, Postgres 14.6, openjdk version "11.0.17" 2022-10-18.

            Hi

            This is back with Confluence 8 and "Confluence Unknown Attachment Reconciliation Plugin" version 2.0.0 which is bundled with it

            Please fix it

            Alex

            Alex Medved {ConfiForms} added a comment - Hi This is back with Confluence 8 and "Confluence Unknown Attachment Reconciliation Plugin" version 2.0.0 which is bundled with it Please fix it Alex

            Hi Oliver, 

            I can't confirm that updating to version 1.0.4 or uninstalling the app solves the error message.

            First we updated the app "Confluence Unknown Attachment Reconciliation Plugin" from version 1.0.3 to 1.0.4 and the error still appears. We uninstalled the app and the message is still displayed. Also clearing the plugin caches did not solve it. 

            Confluence: 7.12.3

            ConfiForms: 2.18.15

            Should I contact Atlassian support? 

             

            Kind regards,

            Dennis

            Dennis Runge added a comment - Hi Oliver,  I can't confirm that updating to version 1.0.4 or uninstalling the app solves the error message. First we updated the app "Confluence Unknown Attachment Reconciliation Plugin" from version 1.0.3 to 1.0.4 and the error still appears. We uninstalled the app and the message is still displayed. Also clearing the plugin caches did not solve it.  Confluence: 7.12.3 ConfiForms: 2.18.15 Should I contact Atlassian support?    Kind regards, Dennis

              ablekhman@atlassian.com Alex Blekhman (Inactive)
              oshen@atlassian.com Oliver Shen
              Affected customers:
              11 This affects my team
              Watchers:
              19 Start watching this issue

                Created:
                Updated:
                Resolved: