Answers.Body: <p>After reading many posts and looking through the ideas I got here I deleted the triggers for the contributions table and rebuilt the triggers (<a href="https://docs.civicrm.org/sysadmin/en/latest/troubleshooting/#trigger-rebuild" rel="nofollow noreferrer">https://docs.civicrm.org/sysadmin/en/latest/troubleshooting/#trigger-rebuild</a>) for the table. This appears to have worked like a charm. </p>
  
  <p>-Steve  </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-28T01:06:19.023Z
Answers.LastActivityDate: 2019-05-28T01:06:19.023Z
Answers.UserDisplayName: Steve Kessler
Body: <p>I am getting the following error on screen when trying to save a membership with a contribution after upgrading to 5.13.4.</p>
  
  <p>We had this problem with all contributions at first but that appears to have resolved itself. </p>
  
  <p>Fatal error: Uncaught CRM_Core_Exception: [0: Transaction integrity error: Expected to find active frame thrown in /home/customer/public_html/sites/all/modules/civicrm/Civi/Core/Transaction/Manager.php on line 107</p>
  
  <p>When looking in the logs I see the full backtrace before that this is listed as the <code>[to_string]</code>.</p>
  
  <p><code>nativecode=1442 **Can't update table 'civicrm_contact' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.</code></p>
  
  <p>Here is the backtrace:</p>
  
  <pre><code>#1 /home/customer/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::handle(Object(DB_Error))
  #2 /home/customer/public_html/sites/all/modules/civicrm/packages/DB.php(985): PEAR_Error-&gt;__construct("DB Error: unknown error", -1, 16, (Array:2), "INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...")
  #3 /home/customer/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error-&gt;__construct(-1, 16, (Array:2), "INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...")
  #4 /home/customer/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR-&gt;_raiseError(Object(DB_mysqli), NULL, -1, 16, (Array:2), "INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...", "DB_Error", TRUE)
  #5 /home/customer/public_html/sites/all/modules/civicrm/packages/DB/common.php(1907): PEAR-&gt;__call("raiseError", (Array:7))
  #6 /home/customer/public_html/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common-&gt;raiseError(-1, NULL, NULL, "INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...", "1442 ** Can't update table'civicrm_contact' in stored function/trigger becau...")
  #7 /home/customer/public_html/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli-&gt;mysqliRaiseError()
  #8 /home/customer/public_html/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli-&gt;simpleQuery("INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...")
  #9 /home/customer/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php(2415): DB_common-&gt;query("INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...")
  #10 /home/customer/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php(1040): DB_DataObject-&gt;_query("INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...")
  #11 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/DAO.php(572): DB_DataObject-&gt;insert()
  #12 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php(231): CRM_Core_DAO-&gt;save()
  #13 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(957): CRM_Contribute_BAO_Contribution::add((Array:30))
  #14 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1771): CRM_Contribute_Form_Contribution_Confirm::processFormContribution(Object(CRM_Contribute_Form_Contribution_Confirm), (Array:66),(Array:62), (Array:30), Object(CRM_Financial_DAO_FinancialType), TRUE, 5, NULL)
  #15 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1487): CRM_Contribute_Form_Contribution_Confirm-&gt;processSecondaryFinancialTransaction("69090",Object(CRM_Contribute_Form_Contribution_Confirm), (Array:62), FALSE, (Array:1), "1.000000000", "2")
  #16 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1392): CRM_Contribute_Form_Contribution_Confirm-&gt;postProcessMembership((Array:60), "69090",Object(CRM_Contribute_Form_Contribution_Confirm), (Array:52), (Array:0), (Array:0), (Array:13), (Array:1), FALSE, NULL, TRUE, "2", (Array:1), FALSE)
  #17 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(2415): CRM_Contribute_Form_Contribution_Confirm-&gt;processMembership((Array:60), "69090", (Array:0), (Array:0), (Array:52), (Array:1))
  #18 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(2290): CRM_Contribute_Form_Contribution_Confirm-&gt;doMembershipProcessing("69090", (Array:60), (Array:52), (Array:1))
  #19 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(709): CRM_Contribute_Form_Contribution_Confirm-&gt;processFormSubmission("69090")
  #20 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/Form.php(490): CRM_Contribute_Form_Contribution_Confirm-&gt;postProcess()
  #21 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/StateMachine.php(160): CRM_Core_Form-&gt;mainProcess()
  #22 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine-&gt;perform(Object(CRM_Contribute_Form_Contribution_Confirm), "next", "Next")
  #23 /home/customer/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next-&gt;perform(Object(CRM_Contribute_Form_Contribution_Confirm), "next")
  #24 /home/customer/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller-&gt;handle(Object(CRM_Contribute_Form_Contribution_Confirm), "next")
  #25 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/Controller.php(349): HTML_QuickForm_Page-&gt;handle("next")
  #26 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(311): CRM_Core_Controller-&gt;run((Array:3), NULL)
  #27 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(85): CRM_Core_Invoke::runItem((Array:15))
  #28 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
  #29 /home/customer/public_html/sites/all/modules/civicrm/drupal/civicrm.module(444): CRM_Core_Invoke::invoke((Array:3))
  #30 /home/customer/public_html/includes/menu.inc(527): civicrm_invoke("contribute", "transact")
  #31 /home/customer/public_html/index.php(21): menu_execute_active_handler()
  #32 {main}
  </code></pre>
  
  <p>There was a similar issue that was resolved for version 4.4.2 - <a href="https://issues.civicrm.org/jira/browse/CRM-13587" rel="nofollow noreferrer">https://issues.civicrm.org/jira/browse/CRM-13587</a>. </p>
  
  <p>I tested the site without our custom extensions enabled and they do not impact the problem. The following extensions are enabled.  </p>
  
  <ul>
  <li>Birthday Report</li>
  <li>CiviDiscount</li>
  <li>Extended Report</li>
  <li>Summary Fields</li>
  <li>Report Error</li>
  </ul>
  
  <p>Any help or ideas is greatly appreciated. </p>
  
  <p>Thanks,
  Steve </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-22T03:40:27.577Z
Comments.Text: are you able to replicate this on eg demo.dmaster.civicrm.org as this would help confirm if this is a global issue or one particular to your set up. also do you have any extensions etc which may be affecting this feature?
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-22T04:46:04.627Z
Comments.Text: I could not reproduce this in dmaster. I did add list of the extensions we have enabled in the post. I tired to do the same transactions and they cannot be made with or without our custom extensions enabled. Thank you!
Comments.UserDisplayName: Steve Kessler
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-22T07:58:43.890Z
Comments.Text: so even with all Extensions disabled, c_templates cleared etc etc you still cannot save a Contribution?
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-22T16:48:34.427Z
Comments.Text: I just checked one more time with deleting  templates_c and we can save contributions but not memberships that have contributions.
Comments.UserDisplayName: Steve Kessler
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-22T19:53:15.283Z
Comments.Text: sounding weirder. are you certain you aren't flipping between www and no www etc
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-22T22:26:15.197Z
Comments.Text: "#6 /home/customer/public_html/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-1, NULL, NULL, "INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...", "1442 ** Can't update table'civicrm_contact' in stored function/trigger becau...")"
  
  So this looks like it relates to logging - do you have that enabled. Try disabling & re-neabling it - esp if you are on a multilingual site. There is also an api to do a schema update on a multilingual site - it could be that
Comments.UserDisplayName: eileen
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-22T23:08:54.567Z
Comments.Text: I am having the same problem after turning on and off logging (logging was not turned on but a log table was defined in civicrm.settings.php).Now it is off and the table is not referenced in civicrm.settings.php. I ran the multilingual schema update too but no such luck. Thank you for your help.
Comments.UserDisplayName: Steve Kessler
Tags: <civimember><contributions>
Title: Error Saving Membership Transactions After Upgrading To 5.13.4
ThreadText: # Error Saving Membership Transactions After Upgrading To 5.13.4
  
  (Asked by: username_0 on 2019-05-22)
  
  I am getting the following error on screen when trying to save a membership with a contribution after upgrading to 5.13.4.
  We had this problem with all contributions at first but that appears to have resolved itself. 
  Fatal error: Uncaught CRM_Core_Exception: [0: Transaction integrity error: Expected to find active frame thrown in /home/customer/public_html/sites/all/modules/civicrm/Civi/Core/Transaction/Manager.php on line 107
  When looking in the logs I see the full backtrace before that this is listed as the [to_string].
  nativecode=1442 **Can't update table 'civicrm_contact' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
  Here is the backtrace:
  #1 /home/customer/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::handle(Object(DB_Error))
  #2 /home/customer/public_html/sites/all/modules/civicrm/packages/DB.php(985): PEAR_Error->__construct("DB Error: unknown error", -1, 16, (Array:2), "INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...")
  #3 /home/customer/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-1, 16, (Array:2), "INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...")
  #4 /home/customer/public_html/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -1, 16, (Array:2), "INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...", "DB_Error", TRUE)
  #5 /home/customer/public_html/sites/all/modules/civicrm/packages/DB/common.php(1907): PEAR->__call("raiseError", (Array:7))
  #6 /home/customer/public_html/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-1, NULL, NULL, "INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...", "1442 ** Can't update table'civicrm_contact' in stored function/trigger becau...")
  #7 /home/customer/public_html/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
  #8 /home/customer/public_html/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...")
  #9 /home/customer/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php(2415): DB_common->query("INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...")
  #10 /home/customer/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php(1040): DB_DataObject->_query("INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...")
  #11 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/DAO.php(572): DB_DataObject->insert()
  #12 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php(231): CRM_Core_DAO->save()
  #13 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(957): CRM_Contribute_BAO_Contribution::add((Array:30))
  #14 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1771): CRM_Contribute_Form_Contribution_Confirm::processFormContribution(Object(CRM_Contribute_Form_Contribution_Confirm), (Array:66),(Array:62), (Array:30), Object(CRM_Financial_DAO_FinancialType), TRUE, 5, NULL)
  #15 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1487): CRM_Contribute_Form_Contribution_Confirm->processSecondaryFinancialTransaction("69090",Object(CRM_Contribute_Form_Contribution_Confirm), (Array:62), FALSE, (Array:1), "1.000000000", "2")
  #16 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1392): CRM_Contribute_Form_Contribution_Confirm->postProcessMembership((Array:60), "69090",Object(CRM_Contribute_Form_Contribution_Confirm), (Array:52), (Array:0), (Array:0), (Array:13), (Array:1), FALSE, NULL, TRUE, "2", (Array:1), FALSE)
  #17 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(2415): CRM_Contribute_Form_Contribution_Confirm->processMembership((Array:60), "69090", (Array:0), (Array:0), (Array:52), (Array:1))
  #18 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(2290): CRM_Contribute_Form_Contribution_Confirm->doMembershipProcessing("69090", (Array:60), (Array:52), (Array:1))
  #19 /home/customer/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(709): CRM_Contribute_Form_Contribution_Confirm->processFormSubmission("69090")
  #20 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/Form.php(490): CRM_Contribute_Form_Contribution_Confirm->postProcess()
  #21 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/StateMachine.php(160): CRM_Core_Form->mainProcess()
  #22 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine->perform(Object(CRM_Contribute_Form_Contribution_Confirm), "next", "Next")
  #23 /home/customer/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Contribute_Form_Contribution_Confirm), "next")
  #24 /home/customer/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contribute_Form_Contribution_Confirm), "next")
  #25 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/Controller.php(349): HTML_QuickForm_Page->handle("next")
  #26 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(311): CRM_Core_Controller->run((Array:3), NULL)
  #27 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(85): CRM_Core_Invoke::runItem((Array:15))
  #28 /home/customer/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
  #29 /home/customer/public_html/sites/all/modules/civicrm/drupal/civicrm.module(444): CRM_Core_Invoke::invoke((Array:3))
  #30 /home/customer/public_html/includes/menu.inc(527): civicrm_invoke("contribute", "transact")
  #31 /home/customer/public_html/index.php(21): menu_execute_active_handler()
  #32 {main}
  
  There was a similar issue that was resolved for version 4.4.2 - https://issues.civicrm.org/jira/browse/CRM-13587. 
  I tested the site without our custom extensions enabled and they do not impact the problem. The following extensions are enabled.  
  
  Birthday Report
  CiviDiscount
  Extended Report
  Summary Fields
  Report Error
  
  Any help or ideas is greatly appreciated. 
  Thanks,
  Steve
  
  **Tags:** civimember, contributions
  
  > **Comments:**
  > **username_1**: are you able to replicate this on eg demo.dmaster.civicrm.org as this would help confirm if this is a global issue or one particular to your set up. also do you have any extensions etc which may be affecting this feature?  
  > **username_0**: I could not reproduce this in dmaster. I did add list of the extensions we have enabled in the post. I tired to do the same transactions and they cannot be made with or without our custom extensions enabled. Thank you!  
  > **username_1**: so even with all Extensions disabled, c_templates cleared etc etc you still cannot save a Contribution?  
  > **username_0**: I just checked one more time with deleting  templates_c and we can save contributions but not memberships that have contributions.  
  > **username_1**: sounding weirder. are you certain you aren't flipping between www and no www etc  
  > **username_2**: "#6 /home/customer/public_html/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-1, NULL, NULL, "INSERT INTO civicrm_contribution (contact_id , financial_type_id , contributi...", "1442 ** Can't update table'civicrm_contact' in stored function/trigger becau...")"  So this looks like it relates to logging - do you have that enabled. Try disabling & re-neabling it - esp if you are on a multilingual site. There is also an api to do a schema update on a multilingual site - it could be that  
  > **username_0**: I am having the same problem after turning on and off logging (logging was not turned on but a log table was defined in civicrm.settings.php).Now it is off and the table is not referenced in civicrm.settings.php. I ran the multilingual schema update too but no such luck. Thank you for your help.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-05-28. Score: 4
  
  After reading many posts and looking through the ideas I got here I deleted the triggers for the contributions table and rebuilt the triggers (<https://docs.civicrm.org/sysadmin/en/latest/troubleshooting/#trigger-rebuild>) for the table. This appears to have worked like a charm.
  
  -Steve
  
  
  ---
  
  