CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • Drupal 6 Civi 4.4.3 Why does clean install dashboard URL result in DB errors?
Pages: [1]

Author Topic: Drupal 6 Civi 4.4.3 Why does clean install dashboard URL result in DB errors?  (Read 2037 times)

mdlueck

  • Ask me questions
  • ****
  • Posts: 382
  • Karma: 4
  • CiviCRM version: 4.7.24
  • CMS version: Drupal 6.x
  • MySQL version: 5.5.54
  • PHP version: 5.3.10
Drupal 6 Civi 4.4.3 Why does clean install dashboard URL result in DB errors?
January 17, 2014, 04:16:05 pm
I enabled Drupal Watchdog logging to obtain an easier to copy/paste version of errors I see right off in the CiviCRM log file.

I believe this was caused by visiting the CiviCRM dashboard URL.

The two Drupal Watchdog entries are as follows:

Code: [Select]
Details
Type civicrm
Date Friday, January 17, 2014 - 20:08
User drupal_admin
Location http://d1.testdomain.org/civicrm/ajax/dashboard?op=get_widgets_by_column&key=17e3b9b7273d810f7cd4c7384be8a58b
Referrer http://d1.testdomain.org/civicrm/dashboard?reset=1
Message $Fatal Error Details = Array ( [callback] => Array ( [0] => CRM_Core_Error [1] => handle ) [code] => -3 [message] => DB Error: constraint violation [mode] => 16 [debug_info] => INSERT INTO civicrm_dashboard_contact (dashboard_id, contact_id, column_no, is_active) VALUES (1, 6, 1, 1), (2, 6, 0, 0) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`d1cir_civicrm`.`civicrm_dashboard_contact`, CONSTRAINT `FK_civicrm_dashboard_contact_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)] [type] => DB_Error [user_info] => INSERT INTO civicrm_dashboard_contact (dashboard_id, contact_id, column_no, is_active) VALUES (1, 6, 1, 1), (2, 6, 0, 0) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`d1cir_civicrm`.`civicrm_dashboard_contact`, CONSTRAINT `FK_civicrm_dashboard_contact_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)] [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_dashboard_contact (dashboard_id, contact_id, column_no, is_active) VALUES (1, 6, 1, 1), (2, 6, 0, 0) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`d1cir_civicrm`.`civicrm_dashboard_contact`, CONSTRAINT `FK_civicrm_dashboard_contact_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]"] )
Severity debug

Code: [Select]
Type civicrm
Date Friday, January 17, 2014 - 20:08
User drupal_admin
Location http://d1.testdomain.org/civicrm/ajax/dashboard?op=get_widgets_by_column&key=17e3b9b7273d810f7cd4c7384be8a58b
Referrer http://d1.testdomain.org/civicrm/dashboard?reset=1
Message $backTrace = #0 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/CRM/Core/Error.php(197): CRM_Core_Error::backtrace("backTrace", TRUE) #1 [internal function](): CRM_Core_Error::handle(Object(DB_Error)) #2 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error)) #3 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/packages/DB.php(969): PEAR_Error->PEAR_Error("DB Error: constraint violation", -3, 16, (Array:2), "INSERT INTO civicrm_dashboard_contact (dashboard_id, contact_id, column_no, i...") #4 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-3, 16, (Array:2), "INSERT INTO civicrm_dashboard_contact (dashboard_id, contact_id, column_no, i...") #5 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -3, NULL, NULL, "INSERT INTO civicrm_dashboard_contact (dashboard_id, contact_id, column_no, i...", "DB_Error", TRUE) #6 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/packages/DB/mysqli.php(928): DB_common->raiseError(-3, NULL, NULL, NULL, "1452 ** Cannot add or update a child row: a foreign key constraint fails (`d1...") #7 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/packages/DB/mysqli.php(402): DB_mysqli->mysqliRaiseError() #8 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("INSERT INTO civicrm_dashboard_contact (dashboard_id, contact_id, column_no, i...") #9 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/packages/DB/DataObject.php(2421): DB_common->query("INSERT INTO civicrm_dashboard_contact (dashboard_id, contact_id, column_no, i...") #10 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/packages/DB/DataObject.php(1613): DB_DataObject->_query("INSERT INTO civicrm_dashboard_contact (dashboard_id, contact_id, column_no, i...") #11 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/CRM/Core/DAO.php(160): DB_DataObject->query("INSERT INTO civicrm_dashboard_contact (dashboard_id, contact_id, column_no, i...") #12 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/CRM/Core/DAO.php(907): CRM_Core_DAO->query("INSERT INTO civicrm_dashboard_contact (dashboard_id, contact_id, column_no, i...", TRUE) #13 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/CRM/Core/BAO/Dashboard.php(126): CRM_Core_DAO::executeQuery("INSERT INTO civicrm_dashboard_contact (dashboard_id, contact_id, column_no, i...") #14 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/CRM/Contact/Page/AJAX.php(888): CRM_Core_BAO_Dashboard::getContactDashlets() #15 [internal function](): CRM_Contact_Page_AJAX::dashboard((Array:3)) #16 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(289): call_user_func((Array:2), (Array:3)) #17 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(72): CRM_Core_Invoke::runItem((Array:12)) #18 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3)) #19 /srv/www/sites/d1.testdomain.org/www/sites/all/modules/civicrm/drupal/civicrm.module(405): CRM_Core_Invoke::invoke((Array:3)) #20 [internal function](): civicrm_invoke("ajax", "dashboard") #21 /srv/www/sites/d1.testdomain.org/www/includes/menu.inc(350): call_user_func_array("civicrm_invoke", (Array:2)) #22 /srv/www/sites/d1.testdomain.org/www/index.php(17): menu_execute_active_handler() #23 {main}
Severity debug
--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Drupal 6 Civi 4.4.3 Why does clean install dashboard URL result in DB errors?
January 18, 2014, 10:38:41 am
Looks like you have deleted contacts that still have records in the dashboard table. You would need to remove this via SQL...
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

mdlueck

  • Ask me questions
  • ****
  • Posts: 382
  • Karma: 4
  • CiviCRM version: 4.7.24
  • CMS version: Drupal 6.x
  • MySQL version: 5.5.54
  • PHP version: 5.3.10
Re: Drupal 6 Civi 4.4.3 Why does clean install dashboard URL result in DB errors?
January 20, 2014, 06:53:37 am
I am starting over with brand new wiped clean CiviCRM... attempting to give it a fare chance at success. I am working with a test copy of our production website to do this. Thus separate databases from production. I completely wiped the CiviCRM database, updated permissions based on the latest instructions, and did the install. That saga detailed here:

Drupal 6 Civi 4.4.3 Why does it want to locate the files directory within config
http://forum.civicrm.org/index.php/topic,31265.0.html

So how could it already have:
Quote
deleted contacts that still have records in the dashboard table.

Everything "CiviCRM" should be wiped clean. No?
--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/

mdlueck

  • Ask me questions
  • ****
  • Posts: 382
  • Karma: 4
  • CiviCRM version: 4.7.24
  • CMS version: Drupal 6.x
  • MySQL version: 5.5.54
  • PHP version: 5.3.10
Re: Drupal 6 Civi 4.4.3 Why does clean install dashboard URL result in DB errors?
January 22, 2014, 09:36:34 am
Since silence persists, providing more detailed response as follows...

Quote from: Hershel on January 18, 2014, 10:38:41 am
that still have records in the dashboard table. You would need to remove this via SQL...

Code: [Select]
SELECT `id` , `domain_id` , `label` , `url`
FROM `civicrm_dashboard`

Code: [Select]
1 1 CiviCRM News civicrm/dashlet/blog&reset=1&snippet=5
2 1 Activities civicrm/dashlet/activity&reset=1&snippet=5
3 1 My Cases civicrm/dashlet/myCases&reset=1&snippet=5
4 1 All Cases civicrm/dashlet/allCases&reset=1&snippet=5
5 1 Case Dashboard Dashlet civicrm/dashlet/casedashboard&reset=1&snippet=5

Code: [Select]
SELECT *
FROM `civicrm_dashboard_contact`

Code: [Select]
MySQL returned an empty result set (i.e. zero rows). ( Query took 0.0003 sec )
Which other "dashboard table" might you be referring to? Thank you.
--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/

mdlueck

  • Ask me questions
  • ****
  • Posts: 382
  • Karma: 4
  • CiviCRM version: 4.7.24
  • CMS version: Drupal 6.x
  • MySQL version: 5.5.54
  • PHP version: 5.3.10
Re: Drupal 6 Civi 4.4.3 Why does clean install dashboard URL result in DB errors?
January 24, 2014, 08:37:58 am
I also saw reference to another table in the error message, so here is a peek at that table:

Code: [Select]
SELECT `id` , `contact_type` , `sort_name` , `display_name` , `legal_name` , `organization_name`
FROM `civicrm_contact`

Code: [Select]
1 Organization Default Organization Default Organization Default Organization Default Organization
Again, this is a clean install (reinstall). CiviCRM seems to grouch at the emptiness of the tables? Or am I missing something?
--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/

mdlueck

  • Ask me questions
  • ****
  • Posts: 382
  • Karma: 4
  • CiviCRM version: 4.7.24
  • CMS version: Drupal 6.x
  • MySQL version: 5.5.54
  • PHP version: 5.3.10
Re: Drupal 6 Civi 4.4.3 Why does clean install dashboard URL result in DB errors?
January 29, 2014, 12:24:04 pm
I added some logging here:
Code: [Select]
# sites/all/modules/civicrm/CRM/Core/BAO/Dashboard.php

    // If empty then initialize contact dashboard for this user
    if (!$hasDashlets) {
      $defaultDashlets = self::getDashlets();
      if ($defaultDashlets) {
        // Add dashlet entries for logged in contact
        // TODO: need to optimize this sql
        $items = '';
        foreach ($defaultDashlets as $key => $values) {
          // Set civicrm blog as default enabled
          $default = $values['url'] == 'civicrm/dashlet/blog&reset=1&snippet=5' ? 1 : 0;
          $items .= ($items ? ', ' : '') . "($key, $contactID, $default, $default)";
        }
        $query = "INSERT INTO civicrm_dashboard_contact (dashboard_id, contact_id, column_no, is_active) VALUES $items";
error_log("key = >" . $key . "<");
error_log("contactID = >" . $contactID . "<");
error_log("query = >" . $query . "<");
        CRM_Core_DAO::executeQuery($query);
      }
    }

It produced the following output:
Code: [Select]
key = >2<, referer: http://d1.testdomain.org/civicrm/dashboard
contactID = >2<, referer: http://d1.testdomain.org/civicrm/dashboard
query = >INSERT INTO civicrm_dashboard_contact (dashboard_id, contact_id, column_no, is_active) VALUES (1, 2, 1, 1), (2, 2, 0, 0)<, referer: http://d1.testdomain.org/civicrm/dashboard

The crash would not occur. I found records successfully inserted into the `civicrm_dashboard_contact` table, so TRUNCATEd it, still no error.

I am thinking the crash was CiviCRM merely "priming the pump" on a brand new empty database. It would be nice to not have CiviCRM crash thusly when encountering a brand new empty database.

Thoughts of what else I must TRUNCATE in order to reproduce the crash so that a report could be filed?
--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • Drupal 6 Civi 4.4.3 Why does clean install dashboard URL result in DB errors?

This forum was archived on 2017-11-26.