Each year we go through an enrollment process, where we have groups of up to 60 users at a time registering for our site simultaneously on our one-CPU, 3GB virtual machine running the latest CiviCRM with Drupal.
We authenticate users using ADFS through SimpleSAMLphp - their user accounts are created in Drupal when, as part of the enrollment process, they click on a link that logs them in and redirects to a webform with the info we want to gather for Civi. i.e. /saml_login?destination=webform
Last year was a laugh-and-a-half when Apache (with mod_php) decided that was all far too much for it to handle, and killed MySQL hard in the process. A few times. Have since switched to Nginx with PHP-FPM and am now sleeping far better at night.
I have noted that about 10% of users are encountering a CiviCRM 'yellow box on white page' error - don't have the exact error message to hand, but to the effect of 'unknown error'.
Looked up the logs, and it's throwing a MySQL error:
[nativecode=1213 ** Deadlock found when trying to get lock; try restarting transaction]
When attempting to run the query:
INSERT INTO civicrm_email (contact_id , location_type_id , email , is_primary , is_billing , on_hold ) VALUES .....
My cursory searching shows a few mentions of this kind of situation in JIRA, but there wasn't much to go on. If anyone has any suggestions of how I'd go about avoiding this happening in the future, I'd be glad to hear them!
Edit:
Aug 24 10:12:39 [info] $Fatal Error Details = Array
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => handle
)
[code] => -1
[message] => DB Error: unknown error
[mode] => 16
[debug_info] => INSERT INTO civicrm_email (contact_id , location_type_id , email , is_primary , is_billing , on_hold ) VALUES ( 69088 , 1 , '[email protected]' , 1 , 0 , 0 ) [nativecode=1213 ** Deadlock found when trying to get lock; try restarting transaction]
[type] => DB_Error
[user_info] => INSERT INTO civicrm_email (contact_id , location_type_id , email , is_primary , is_billing , on_hold ) VALUES ( 69088 , 1 , '[email protected]' , 1 , 0 , 0 ) [nativecode=1213 ** Deadlock found when trying to get lock; try restarting transaction]
[to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_email (contact_id , location_type_id , email , is_primary , is_billing , on_hold ) VALUES ( 69088 , 1 , '[email protected]' , 1 , 0 , 0 ) [nativecode=1213 ** Deadlock found when trying to get lock; try restarting transaction]"]
)
Aug 24 10:12:39 [info] $backTrace = #0 /var/www/html/sites/all/modules/civicrm/CRM/Core/Error.php(232): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /var/www/html/sites/all/modules/civicrm/packages/PEAR.php(921): CRM_Core_Error::handle(Object(DB_Error))
#2 /var/www/html/sites/all/modules/civicrm/packages/DB.php(985): PEAR_Error->__construct("DB Error: unknown error", -1, 16, (Array:2), "INSERT INTO civicrm_email (contact_id , location_type_id , email , is_primary...")
#3 /var/www/html/sites/all/modules/civicrm/packages/PEAR.php(575): DB_Error->__construct(-1, 16, (Array:2), "INSERT INTO civicrm_email (contact_id , location_type_id , email , is_primary...")
#4 /var/www/html/sites/all/modules/civicrm/packages/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -1, 16, (Array:2), "INSERT INTO civicrm_email (contact_id , location_type_id , email , is_primary...", "DB_Error", TRUE)
#5 /var/www/html/sites/all/modules/civicrm/packages/DB/common.php(1907): PEAR->__call("raiseError", (Array:7))
#6 /var/www/html/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-1, NULL, NULL, "INSERT INTO civicrm_email (contact_id , location_type_id , email , is_primary...", "1213 ** Deadlock found when trying to get lock; try restarting transaction")
#7 /var/www/html/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
#8 /var/www/html/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("INSERT INTO civicrm_email (contact_id , location_type_id , email , is_primary...")
#9 /var/www/html/sites/all/modules/civicrm/packages/DB/DataObject.php(2415): DB_common->query("INSERT INTO civicrm_email (contact_id , location_type_id , email , is_primary...")
#10 /var/www/html/sites/all/modules/civicrm/packages/DB/DataObject.php(1040): DB_DataObject->_query("INSERT INTO civicrm_email (contact_id , location_type_id , email , is_primary...")
#11 /var/www/html/sites/all/modules/civicrm/CRM/Core/DAO.php(571): DB_DataObject->insert()
#12 /var/www/html/sites/all/modules/civicrm/CRM/Core/BAO/Email.php(102): CRM_Core_DAO->save()
#13 /var/www/html/sites/all/modules/civicrm/CRM/Core/BAO/Block.php(348): CRM_Core_BAO_Email::add((Array:5))
#14 /var/www/html/sites/all/modules/civicrm/CRM/Core/BAO/Location.php(66): CRM_Core_BAO_Block::create("email", (Array:12), NULL)
#15 /var/www/html/sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php(344): CRM_Core_BAO_Location::create((Array:12), TRUE)
#16 /var/www/html/sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php(2010): CRM_Contact_BAO_Contact::create((Array:12))
#17 /var/www/html/sites/all/modules/civicrm/CRM/Core/BAO/UFMatch.php(298): CRM_Contact_BAO_Contact::createProfileContact((Array:4), (Array:0))
#18 /var/www/html/sites/all/modules/civicrm/CRM/Core/BAO/UFMatch.php(118): CRM_Core_BAO_UFMatch::synchronizeUFMatch(Object(stdClass), "11667", "[email protected]", "Drupal", NULL, "Individual", FALSE)
#19 /var/www/html/sites/all/modules/civicrm/drupal/civicrm_user.inc(51): CRM_Core_BAO_UFMatch::synchronize(Object(stdClass), FALSE, "Drupal", "Individual")
#20 /var/www/html/modules/user/user.module(101): civicrm_user_login((Array:2), Object(stdClass), NULL)
#21 /var/www/html/modules/user/user.module(2308): user_module_invoke("login", (Array:2), Object(stdClass))
#22 /var/www/html/modules/user/user.module(2321): user_login_finalize((Array:2))
#23 /var/www/html/modules/user/user.module(2351): user_login_submit((Array:0), (Array:2))
#24 /var/www/html/sites/all/modules/contrib/simplesamlphp_auth/simplesamlphp_auth.module(241): user_external_login_register("[email protected]", "simplesamlphp_auth")
#25 /var/www/html/includes/module.inc(957): simplesamlphp_auth_init()
#26 /var/www/html/includes/common.inc(5314): module_invoke_all("init")
#27 /var/www/html/includes/bootstrap.inc(2538): _drupal_bootstrap_full()
#28 /var/www/html/index.php(20): drupal_bootstrap(7)
#29 {main}