Cannot save/edit question with image attachment

XMLWordPrintable

    • 1
    • Severity 2 - Major

      NOTE: This bug report is for Confluence Cloud. Using Confluence Server? See the corresponding bug report.

      Summary

      When trying to save or edit a question with an image attachment, an error is thrown, and the question cannot be saved. This also applies to questions with attachments that are edited after the fact (i.e. questions with attachments cannot be edited).

      Steps to Reproduce

      1. Ask a question in Questions for Confluence
      2. Add an image attachment in the question
      3. Add a “Popular topic”
      4. Click Save

      Expected Results

      The question is saved and posted.

      Actual Results

      The below exception is thrown in the Confluence Log file:

      org.springframework.dao.DataIntegrityViolationException: Hibernate operation: Could not execute JDBC batch update; SQL []; Batch entry 0 insert into IMAGEDETAILS (HEIGHT, WIDTH, MIMETYPE, ATTACHMENTID) values (482, 630, 'image/jpeg', 17137749) was aborted. Call getNextException to see the cause.; nested exception is java.sql.BatchUpdateException: Batch entry 0 insert into IMAGEDETAILS (HEIGHT, WIDTH, MIMETYPE, ATTACHMENTID) values (482, 630, 'image/jpeg', 17137749) was aborted. Call getNextException to see the cause.
          at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:102)
      caused by: java.sql.BatchUpdateException: Batch entry 0 insert into IMAGEDETAILS (HEIGHT, WIDTH, MIMETYPE, ATTACHMENTID) values (482, 630, 'image/jpeg', 17137749) was aborted. Call getNextException to see the cause.
          at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2746)
      Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into IMAGEDETAILS (HEIGHT, WIDTH, MIMETYPE, ATTACHMENTID) values (482, 630, 'image/jpeg', 17137749) was aborted.  Call getNextException to see the cause.
      	at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2746)
      	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1887)
      	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:405)
      	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2893)
      	at sun.reflect.GeneratedMethodAccessor621.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.github.gquintana.metrics.proxy.MethodInvocation.proceed(MethodInvocation.java:75)
      	at com.github.gquintana.metrics.sql.AbstractStatementProxyHandler.invoke(AbstractStatementProxyHandler.java:64)
      	at com.github.gquintana.metrics.proxy.ProxyHandler.invoke(ProxyHandler.java:73)
      	at com.sun.proxy.$Proxy525.executeBatch(Unknown Source)
      	at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
      	at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
      	at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
      	at net.sf.hibernate.impl.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:54)
      	at net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:128)
      	at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2465)
      	at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2419)
      	at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2288)
      	at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
      	at org.springframework.orm.hibernate.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:510)
      	... 400 more
      caused by:
      org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "imagedetails_pkey"
      
      

      Notes

      This occurs with or without assigning a question to a space. It has been reproduced in Confluence Cloud version 1000.122.0 and Questions for Confluence version 2.4.14-D20160504T221817.

      Workaround

      Add image attachment as a comment to the question instead of directly in the question.

            Assignee:
            Unassigned
            Reporter:
            Rachel Fuerst (Inactive)
            Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: