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 »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Upgrade to 4.15 DB Error: constraint violation
Pages: [1]

Author Topic: Upgrade to 4.15 DB Error: constraint violation  (Read 2183 times)

zither

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 1
Upgrade to 4.15 DB Error: constraint violation
July 16, 2012, 11:35:37 am
We use Drupal 6 and after we upgraded to 4.15, anonymous users got an error when trying to register for an event:

Sorry. A non-recoverable error has occurred.

DB Error: Constraint violation

Please see the screen capture below:

http://screencast.com/t/peA8Pcal

Any advice, please?

Thanks a lot!

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Upgrade to 4.15 DB Error: constraint violation
July 16, 2012, 12:25:13 pm
Can you enable debugging in CiviCRM and try again and then post the full message?
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.

zither

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 1
Re: Upgrade to 4.15 DB Error: constraint violation
July 16, 2012, 01:31:09 pm
I enabled debugging and clicked Save. I got a blank page. Then I ran these two:

// Example URL
http://...../?q=civicrm/admin&sessionReset=2
 
// Example with Clean URLs
http://...../civicrm/admin?sessionReset=2

I still got blank page respectively.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Upgrade to 4.15 DB Error: constraint violation
July 16, 2012, 01:33:31 pm
Hmm. Can you check your error logs?
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.

zither

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 1
Re: Upgrade to 4.15 DB Error: constraint violation
July 16, 2012, 01:53:49 pm
I checked the error log on our server. Here are a few of them:

[Mon Jul 16 15:09:51 2012] [error] [Mon Jul 16 15:09:51 2012] [error] [client] Directory index forbidden by Options directive: /var/www/vhosts/mysite.com/httpdocs/learnersvoice/wp-content/themes/Chameleon/epanel/shortcodes/js/, referer: http://mysite:80/learnersvoice
[Mon Jul 16 15:24:37 2012] [error] [client ] Directory index forbidden by Options directive: /var/www/vhosts/mysite.com/httpdocs/sites/default/, referer: https://www.assessment.com:443/resources/
[Mon Jul 16 15:24:37 2012] [error] [client] Directory index forbidden by Options directive: /var/www/vhosts/mysite.com/httpdocs/sites/default/, referer: https://www.assessment.com:443/resources/
[Mon Jul 16 16:04:48 2012] [warn] mod_fcgid: stderr: PHP Warning: curl_setopt() [<a href='function.curl-setopt'>function.curl-setopt</a>]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /var/www/vhosts/mysite.com/httpdocs/learnersvoice/wp-content/plugins/wp-stats-dashboard/classes/util/metrics/WPSDStats.php on line 270
[Mon Jul 16 16:21:32 2012] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
[Mon Jul 16 16:31:55 2012] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function Directory index forbidden by Options directive: /var/www/vhosts/www.mysite.com/httpdocs/learnersvoice/wp-content/themes/Chameleon/epanel/shortcodes/js/, referer: http://mysite.com:80/learnersvoice
[Mon Jul 16 15:24:37 2012] [error] [client ] Directory index forbidden by Options directive: /var/www/vhosts/mysite.com/httpdocs/sites/default/, referer: https://www.assessment.com:443/resources/
[Mon Jul 16 15:24:37 2012] [error] [client ] Directory index forbidden by Options directive: /var/www/vhosts/mysite.com/httpdocs/sites/default/, referer: https://www.assessment.com:443/resources/
[Mon Jul 16 16:04:48 2012] [warn] mod_fcgid: stderr: PHP Warning: curl_setopt() [<a href='function.curl-setopt'>function.curl-setopt</a>]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /var/www/vhosts/mysite.com/httpdocs/learnersvoice/wp-content/plugins/wp-stats-dashboard/classes/util/metrics/WPSDStats.php on line 270
[Mon Jul 16 16:21:32 2012] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
[Mon Jul 16 16:31:55 2012] [warn] (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function

Thanks a lot for your help!!

zither

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 1
Re: Upgrade to 4.15 DB Error: constraint violation
July 16, 2012, 02:22:15 pm
There is only one containing CiviCRM:

[Mon Jul 16 15:04:37 2012] [error] [client ] Directory index forbidden by Options directive: /var/www/vhosts/mysite.com/httpdocs/sites/all/modules/civicrm/

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Upgrade to 4.15 DB Error: constraint violation
July 16, 2012, 02:44:42 pm
I do not see in there what is causing a blank page. :(

Perhaps consider removing sites/default/civicrm.settings.php, then re-installing into a fresh DB, insure that CiviCRM 4.1.5 runs OK and then edit your new civicrm.settings.php to point to the old DB and see what happens.

I'm not sure what the issue is so we must debug it...
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.

zither

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 1
Re: Upgrade to 4.15 DB Error: constraint violation
July 17, 2012, 08:10:45 am
Hershel,

I mistakenly posted the error log from the production site while I got blank page on the development site.

The current situation is authenticated users have no problem registering while anonymous users get DB error: constraint violation.

Now, here is what appeared in  the error log after I tried to register for the event as anonymous user, although I don't see anything related to CiviCRM:

[Tue Jul 17 10:55:47 2012] [warn] mod_fcgid: stderr: PHP Warning: curl_setopt() [<a href='function.curl-setopt'>function.curl-setopt</a>]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /var/www/vhosts/mysite.com/httpdocs/learnersvoice/wp-content/plugins/wp-stats-dashboard/classes/util/metrics/WPSDStats.php on line 270


Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Upgrade to 4.15 DB Error: constraint violation
July 17, 2012, 08:21:25 am
No that doesn't look like it. Did you enable debugging in CiviCRM?
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.

zither

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 1
Re: Upgrade to 4.15 DB Error: constraint violation
July 17, 2012, 08:25:09 am
Ok, I enabled debugging and backtrace:

backTrace

/var/www/vhosts/mysite.com/httpdocs/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 288
/var/www/vhosts/mysite.com/httpdocs/sites/all/modules/civicrm/CRM/Utils/Request.php, fatal, 110
/var/www/vhosts/mysite.com/httpdocs/sites/all/modules/civicrm/CRM/Event/StateMachine/Registration.php, retrieve, 55
/var/www/vhosts/mysite.com/httpdocs/sites/all/modules/civicrm/CRM/Event/Controller/Registration.php, __construct, 46
/var/www/vhosts/mysite.com/httpdocs/sites/all/modules/civicrm/CRM/Core/Invoke.php(240) : eval()'d code, __construct, 1
/var/www/vhosts/mysite.com/httpdocs/sites/all/modules/civicrm/CRM/Core/Invoke.php, eval, 240
/var/www/vhosts/mysite.com/httpdocs/sites/all/modules/civicrm/drupal/civicrm.module, invoke, 381
, civicrm_invoke,
/var/www/vhosts/mysite.com/httpdocs/includes/menu.inc, call_user_func_array, 350
/var/www/vhosts/mysite.com/httpdocs/index.php, menu_execute_active_handler, 17

zither

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 1
Re: Upgrade to 4.15 DB Error: constraint violation
July 17, 2012, 08:33:27 am
Error Details:

Database Error Code: Cannot add or update a child row: a foreign key constraint fails (`cetlcrm`.`civicrm_value_fall_teaching_kick_off_10`, CONSTRAINT `FK_civicrm_value_fall_teaching_kick_d0794b3f0fedefbc` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_participant` (`id`) ON DELE), 1452
Additional Details:
Array
(
    [callback] => Array
        (
           
  • => CRM_Core_Error
  • [1] => handle
            )

       
Code: [Select]
=> -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_value_fall_teaching_kick_off_10  ( please_check_off_all_the_session_16,entity_id ) VALUES ( 'kick_off_1',3743 ) ON DUPLICATE KEY UPDATE please_check_off_all_the_session_16 = 'kick_off_1' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`cetlcrm`.`civicrm_value_fall_teaching_kick_off_10`, CONSTRAINT `FK_civicrm_value_fall_teaching_kick_d0794b3f0fedefbc` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_participant` (`id`) ON DELE)]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_value_fall_teaching_kick_off_10  ( please_check_off_all_the_session_16,entity_id ) VALUES ( 'kick_off_1',3743 ) ON DUPLICATE KEY UPDATE please_check_off_all_the_session_16 = 'kick_off_1' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`cetlcrm`.`civicrm_value_fall_teaching_kick_off_10`, CONSTRAINT `FK_civicrm_value_fall_teaching_kick_d0794b3f0fedefbc` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_participant` (`id`) ON DELE)]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_value_fall_teaching_kick_off_10  ( please_check_off_all_the_session_16,entity_id ) VALUES ( 'kick_off_1',3743 ) ON DUPLICATE KEY UPDATE please_check_off_all_the_session_16 = 'kick_off_1' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`cetlcrm`.`civicrm_value_fall_teaching_kick_off_10`, CONSTRAINT `FK_civicrm_value_fall_teaching_kick_d0794b3f0fedefbc` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_participant` (`id`) ON DELE)]"]
)

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Upgrade to 4.15 DB Error: constraint violation
July 18, 2012, 06:19:40 am
Your last post has the answer. The issue is that your civicrm_value_fall_teaching_kick_off_10 custom data group is failing. I don't know why, but CiviCRM is trying to save a record to that table and it's using a value that doesn't exist as an id in the civicrm_participant table.

Not sure why it is doing that and not 100% sure how to fix it, but first thing is to disable that group or profile and see if that fixes it. If so, then perhaps try to make a fresh data group and see if it will work better.
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.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Upgrade to 4.15 DB Error: constraint violation
July 18, 2012, 06:56:51 am

most likely that custom group changed from extending event to extending participant. There was a bug in a prior version of civicrm which did not fix the correspnding FK

Your best bet might be to create a new custom table that extends participant and use those fields for that event

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

zither

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 1
Re: Upgrade to 4.15 DB Error: constraint violation
July 18, 2012, 07:31:54 am
Hershel and Lobo,

Thanks a lot for your patience and help!!

Based on your thoughts, I think I found what the issue was. I used to use a profile that involved both Individual and Participant data. It seems the combination would not work. I created a new profile and all fields are from Participant data and now the registration works. I didn't change anything in the database tables.

Again, I really appreciate your help.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Upgrade to 4.15 DB Error: constraint violation

This forum was archived on 2017-11-26.