Weceem

Hibernate errors occurring intermittently from auto publication job

Details

  • Type: Bug Bug
  • Status: Reopened Reopened
  • Priority: Critical Critical
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: 0.9
  • Component/s: None
  • Labels:
    None
  • Request Controller:
    Please Select
  • External Supervisor:
    Please select
  • Executing Programmer:
    Please select

Description

org.quartz.JobExecutionException: collection [org.weceem.content.WcmContent.children] was not processed by flush() [See nested exception: org.hibernate.AssertionFailure: collection [org.weceem.content.WcmContent.children] was not processed by flush()]  

This is likely due to some side-effects of beforeUpdate/Insert, or some grails equals()/hashCode() impl issues. It relates to elements being loaded during the flush process.

Activity

Hide
Marc Palmer added a comment - 23/Jun/10 2:32 PM

I cannot reproduce this at this time with 0.9 trunk, it may be gone in 0.9 (was occurring in an earlier 0.9 snapshot for Michael Astreika)

Show
Marc Palmer added a comment - 23/Jun/10 2:32 PM I cannot reproduce this at this time with 0.9 trunk, it may be gone in 0.9 (was occurring in an earlier 0.9 snapshot for Michael Astreika)
Hide
Astreiko, Mikhail added a comment - 02/Jul/10 9:39 AM

Problem occurres when trying to set status to null in WcmContentRepositoryService#publishPendingContent.
To fix modify code, please:

-            content.status = WcmStatus.findByPublicContentAndCodeGreaterThan(true, content.status.code)
+            def status = WcmStatus.findByPublicContentAndCodeGreaterThan(true, content.status.code)
+            if (status) {
+                content.status = status
+            }
Show
Astreiko, Mikhail added a comment - 02/Jul/10 9:39 AM Problem occurres when trying to set status to null in WcmContentRepositoryService#publishPendingContent. To fix modify code, please:
-            content.status = WcmStatus.findByPublicContentAndCodeGreaterThan(true, content.status.code)
+            def status = WcmStatus.findByPublicContentAndCodeGreaterThan(true, content.status.code)
+            if (status) {
+                content.status = status
+            }
Hide
Marc Palmer added a comment - 02/Jul/10 10:02 AM

I don't believe this fixes anything, it just stops the error condition being reported. There should not be content that does not have a higher public status being passed to the above code, the criteria should only select non-published content, and the default public status is higher than the non-public ones.

We need log output in there to show what content matched and is being migrated, and trapping for missing public status with log output.

Show
Marc Palmer added a comment - 02/Jul/10 10:02 AM I don't believe this fixes anything, it just stops the error condition being reported. There should not be content that does not have a higher public status being passed to the above code, the criteria should only select non-published content, and the default public status is higher than the non-public ones. We need log output in there to show what content matched and is being migrated, and trapping for missing public status with log output.
Hide
Marc Palmer added a comment - 02/Jul/10 2:51 PM

Improved robustness and logging output, but still cannot reproduce the original problem using the imported space from the app that had the problem.

Show
Marc Palmer added a comment - 02/Jul/10 2:51 PM Improved robustness and logging output, but still cannot reproduce the original problem using the imported space from the app that had the problem.
Hide
Astreiko, Mikhail added a comment - 25/Aug/10 10:28 AM

Problem was reproduced again with Weceem-0.9.1 and grails-1.3.1.
And fixed by modifying WcmContentRepositoryService#publishPendingContent method to use Ids instead of entities

WcmContentRepositoryService.groovy
/**
     * Look for any content pending publication, and move statys to published
     */
    def publishPendingContent() {
        if (log.debugEnabled) {
            log.debug "Looking for content that needs to become published now"
        }
        def now = new Date()
        // Find all content with publication date less than now
        
        // @todo this can be improved by flattening the query, using inList criteria to specify only the list
        // of possible statuses we can process (i.e. all - unmoderated - archived)
        def pendingContentIds = WcmContent.withCriteria {
            projections{
                property("id")
            }
            isNotNull('publishFrom')
            lt('publishFrom', now)
            status {
                and {
                    eq('publicContent', false)
                    ne('code', unmoderatedStatusCode)
                }
            }
        }
        def count = 0
        pendingContentIds?.each { contentId ->
            // Find the next status (in code order) that is public content, after the content's current status
            def st = WcmContent.executeQuery("select wc.status from WcmContent wc where wc.id = ?", [contentId])[0]
            def status = WcmStatus.findByPublicContentAndCodeGreaterThan(true, st.code)
            if (!status) {
                log.error "Tried to publish contentId ${contentId} with status [${st.dump()}] but found no public status with a code higher than it"
            } else {
                log.debug "Transitioning contentId ${contentId} from status [${st.code}] to [${status.code}]"
                WcmContent.executeUpdate("update WcmContent wc set wc.status = ? where wc.id = ?", [status, contentId])
            }            
            count++
        }
        return count
    }

Please, make appropriate changes in trunk

Show
Astreiko, Mikhail added a comment - 25/Aug/10 10:28 AM Problem was reproduced again with Weceem-0.9.1 and grails-1.3.1. And fixed by modifying WcmContentRepositoryService#publishPendingContent method to use Ids instead of entities
WcmContentRepositoryService.groovy
/**
     * Look for any content pending publication, and move statys to published
     */
    def publishPendingContent() {
        if (log.debugEnabled) {
            log.debug "Looking for content that needs to become published now"
        }
        def now = new Date()
        // Find all content with publication date less than now
        
        // @todo this can be improved by flattening the query, using inList criteria to specify only the list
        // of possible statuses we can process (i.e. all - unmoderated - archived)
        def pendingContentIds = WcmContent.withCriteria {
            projections{
                property("id")
            }
            isNotNull('publishFrom')
            lt('publishFrom', now)
            status {
                and {
                    eq('publicContent', false)
                    ne('code', unmoderatedStatusCode)
                }
            }
        }
        def count = 0
        pendingContentIds?.each { contentId ->
            // Find the next status (in code order) that is public content, after the content's current status
            def st = WcmContent.executeQuery("select wc.status from WcmContent wc where wc.id = ?", [contentId])[0]
            def status = WcmStatus.findByPublicContentAndCodeGreaterThan(true, st.code)
            if (!status) {
                log.error "Tried to publish contentId ${contentId} with status [${st.dump()}] but found no public status with a code higher than it"
            } else {
                log.debug "Transitioning contentId ${contentId} from status [${st.code}] to [${status.code}]"
                WcmContent.executeUpdate("update WcmContent wc set wc.status = ? where wc.id = ?", [status, contentId])
            }            
            count++
        }
        return count
    }
Please, make appropriate changes in trunk

People

Vote (0)
Watch (0)

Dates

  • Created:
    23/Jun/10 12:58 PM
    Updated:
    25/Aug/10 10:28 AM