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

Corrupted context during mail preparation cause templated mails to not being sent to all recipients

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 7.1.4, 7.4.1, 8.0-milestone-1
    • Fix Version/s: 8.0-milestone-2, 7.4.2
    • Component/s: Mail
    • Labels:
      None
    • Tests:
      Unit
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      Description

      During mail preparation, to provide to all mails an independent context, the context is cloned for each mail. The XWikiContext itself contains reference to the current Hibernate session and Hibernate transaction, and these get cleanup (rollback transaction) in the original context, but are kept closed in the cloned context. When the cloned context is used for an hibernate transaction, the state of the transaction is wrong, causing:

      Caused by: org.hibernate.SessionException: Session is closed!
      at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java)
      at org.hibernate.impl.SessionImpl.afterTransactionBegin(SessionImpl.java)
      at org.hibernate.jdbc.JDBCContext.afterTransactionBegin(JDBCContext.java)
      at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java)
      at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java)
      at com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java)
      at com.xpn.xwiki.store.XWikiHibernateBaseStore.beginTransaction(XWikiHibernateBaseStore.java)
      at com.xpn.xwiki.store.XWikiHibernateStore.loadXWikiDoc(XWikiHibernateStore.java)
      ...
      

      The hibernate session/transaction should be clean up before clone to prevent this issue.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                softec Denis Gervalle
                Reporter:
                softec Denis Gervalle
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: