+ Start a Discussion
steve_andersensteve_andersen 

Weird DML Exception on code I have in production in other instances

I've got some Apex that gets triggered by Opportunity changes. I'm getting a weird error that I can't comprehend

20080528201313.794:Class.ONEN_TEST_Opp_AddCampaignMbrship.OppToCampaign_NotCampMbr: line 183, column 9: DML Operation executed in 180 ms

System.DmlException: Update failed. First exception on row 0 with id 006S00000029WJ6IAM; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY,

ONENLABS_Opp_TriggerMirrorPaymentUpdate: execution of AfterUpdate

caused by: System.DmlException: Update failed. First exception on row 0 with id a0SS000000002piMAA; first error: UNKNOWN_EXCEPTION, assertion failed

Trigger.ONENLABS_Opp_TriggerMirrorPaymentUpdate: line 40, column 9

Class.ONEN_TEST_Opp_AddCampaignMbrship.OppToCampaign_NotCampMbr: line 183, column 9

I've got this code working on other servers, but with this new install I get an Update error with no helpful information. The record exists and looks fine but won't update.

Can anyone help me out with what this "assertion failed" error means? I don't think it means that one of my test assertions is failing, as it's not reporting the expected and actual values.

I also can't replicate these apex errors by manipulating data in the UI, and I have another test that does basically the same thing and doesn't cause errors.

I've ruled out governor limits, since I get no messages, and I don't seem to have conflicting triggers or workflow that is out of sequence. Just this weird DML exception.

Thanks!


werewolfwerewolf
Can you turn on Debug Logs in this org and try the update then?  The Debug Logs may give you a better idea of what's going on.
steve_andersensteve_andersen
I turned on the debug log and got basically the same thing:

Code:
20080610152227.096:Trigger.ONENLABS_Opp_TriggerMirrorPaymentUpdate: line 7, column 5: TRIGGER FIRED
20080610152227.096:Trigger.ONENLABS_Opp_TriggerMirrorPaymentUpdate: line 39, column 9: Payments to update: (OppPayment__c:{zzUpdateToggle__c=true, IsInstallment__c=false, Id=a0SS0000000043kMAA})
System.DmlException: Update failed. First exception on row 0 with id a0SS0000000043kMAA; first error: UNKNOWN_EXCEPTION, assertion failed

Trigger.ONENLABS_Opp_TriggerMirrorPaymentUpdate: line 40, column 9

System.DmlException: Update failed. First exception on row 0 with id 006S0000002DQ5PIAW; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, ONENLABS_Opp_TriggerMirrorPaymentUpdate: execution of AfterUpdate

caused by: System.DmlException: Update failed. First exception on row 0 with id a0SS0000000043kMAA; first error: UNKNOWN_EXCEPTION, assertion failed

Trigger.ONENLABS_Opp_TriggerMirrorPaymentUpdate: line 40, column 9

Class.ONEN_TEST_Opp_AddCampaignMbrship.OppToCampaign_NotCampMbr: line 183, column 9

*** Ending Test ONEN_TEST_Opp_AddCampaignMbrship.static testMethod void OppToCampaign_NotCampMbr()

 Like I said, I can't reproduce the error in the UI. I follow the exact steps of the test in the UI and everything works fine. I'm pretty confident the code works as expected, but I can't deploy because of this test failure.

Any advice or ideas?

Steve

werewolfwerewolf
You don't have any assert statements right in the trigger, do you?  That would cause an assertion failure also.
steve_andersensteve_andersen
Nope, I don't have any assertions in the trigger.

More information: I've got the code in a sandbox with all tests passing and the UI behaving as I want. When I package up the code and install in production, I get the assertion error.

I burned a new sandbox yesterday, and I get the error in that new sandbox. But not in my old sandbox. And when I compare the code in the one sandbox to the other, all classes and triggers are identical.

I'm a bit stumped.
werewolfwerewolf
Have you logged an issue with Salesforce Support yet?  It's possible you've identified a bug.
steve_andersensteve_andersen
I think I've got trigger conflict. I've got a trigger that rolls up amount from the Opps to the Contacts who are Primay Contact Roles. I also have a trigger that creates and manages the payments which are children to the opp.

When one runs but the other doesn't, it's fine. But when the data change causes both to fire, I get the error.

I still wish the error was more helpful!

Thanks for your help.

Steve
werewolfwerewolf
Oh yeah, I just noticed in your log trace that the same trigger seems to be firing twice.  Could it be some kind of stack overflow where one trigger calls the other which calls the first one until they both collapse?
steve_andersensteve_andersen
After digging into the triggers, I don't think I have a conflict.

I'm blowing up when I'm trying to update a custom object that is related to Opp. When I try to edit one of those custom object records by hand I get:

Code:
An internal server error has occurred
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact support@salesforce.com. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

Thank you again for your patience and assistance. And thanks for using Salesforce!

Error ID: 532851674-213 

On this custom object I have a field that is used as a rollup summary to the Opp. I don't know if that has anything to do with it. deletion and recreation of the rollup summaries didn't fix it.

On this custom object I have some workflow field updates and a delete trigger. If I turn off all the workflow and I still get the Internal server error.

So now I have a custom object with only a delete trigger on it and a rollup summary field to Opp. And I get internal server error when I try to update it. When I delete the summary rollups on Opp, I still get the error.

Now I really don't know what's going on!

Steve

werewolfwerewolf
Well, that sounds like a bug then -- definitely contact Salesforce Support on it.
steve_andersensteve_andersen
I submitted this as a bug. In recent months, I have not been getting timely responses to submitted cases, with them going unanswered for weeks. We'll see this time. I'm not optimistic because of the release happening this weekend.

Here's video proof that I can blow up the platform on demand even without triggers...



Steve


Message Edited by steve_andersen on 06-12-2008 08:07 AM

Message Edited by steve_andersen on 06-12-2008 08:08 AM
werewolfwerewolf
So yes, it turns out this is a bug, and Salesforce has already fixed it and will release the fix in a patch shortly.