1

Using CFWheels I sometimes get an error email stating that there was a DB error [Amazon](500310) Invalid operation: table 250818 dropped by concurrent transaction. After reading about this, it seems this can happen when a second transaction starts before the first is finished. (I'm not editing data here, just SELECT statements).

The odd part is in my trace in the error email I get something like the following:

Line 85 in models\ModelA.cfc
Line 73 in controllers\ControllerA.cfc
Line 85 in models\ModelA.cfc
Line 73 in controllers\ControllerA.cfc

Like it tried to run the same code twice. FYI, you can't follow my code and go from 73 to 85 and then back to 73. You just can't. It doesn't work that way. You do go from 73 to 85 and that makes sense, but I don't see why it's doing it twice.

What would cause my code to at least appear like it's running twice in the same request as I feel that is the underlying reason this DB error is happening.

EDIT: Example where this has taken place

Controller:

<cfparam name="params.key" default="0" />
<cfset resource = model("courseResource").findByKey(params.key) />
<cfif isObject(resource)>
    <cfset course = model('Course').courseInfo(resource.id) />
    <cfquery dbtype="query" name="course">
        SELECT * FROM course ORDER BY id
    </cfquery>
    <!--- HERE IS WHERE ERROR OCCURRED --->
    <cfset var enrollment = model("course").getCourseEnrollment(resource.id) />
    <cfset resource.handoutdate = dateFormat(resource.handoutDate,'mm/dd/yyyy') />
<cfelse>
    <cfset logEvent(SESSION.user.getProperty('id'),'Editing course resource - Missing',params.key) />
    <cfset redirectTo(back="true",error="Course resource could not be found") />
</cfif>

Model Function:

<cfargument name="id" type="string" required="true" />
<cfargument name="students" type="string" required="false" default="" />
<cfquery datasource="DSN" name="local.qEnrollment">
    SELECT 
    DISTINCT *fieldnames*
    FROM course_dim c
    INNER JOIN course_section_dim cs ON cs.course_id = c.id
    INNER JOIN enrollment_dim e ON e.course_section_id = cs.id AND e.type = 'TypeName' AND e.workflow_state = 'active'
    INNER JOIN user_dim u ON u.id = e.user_id
    INNER JOIN pseudonym_dim p ON p.user_id = u.id
    WHERE c.id IN (<cfqueryparam value="#ARGUMENTS.id#" list="yes" />)
    AND c.sis_source_id IS NOT NULL
    <cfif ARGUMENTS.students NEQ ''>
        AND p.unique_name IN (<cfqueryparam value="#ARGUMENTS.students#" list="yes" />)
    </cfif>
    AND e.workflow_state = 'active'
    ORDER BY u.name
</cfquery>
<cfreturn qEnrollment />

I'm not sure what you could possibly get from that, but that is essentially it. I mean there is nothing crazy. I just don't understand how the line that calls the model function can appear twice in the trace. It doesn't make any sense.

Leeish
  • 5,203
  • 2
  • 17
  • 45
  • We will need to see some actual code and not just a description of what it does. – Scott Stroz Jun 28 '16 at 18:31
  • I'm not sure how to provide a minimal example, I'll review the few places it has happened and try to provide some context to see if that helps. – Leeish Jun 28 '16 at 18:48

0 Answers0