Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Here is the full output from the most recent occurance:
<h1>Uncaught exception thrown in shutdown function.</h1><p>PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: DELETE FROM {semaphore}
WHERE (value = :db_condition_placeholder_0) ; Array
(
[:db_condition_placeholder_0] =&gt; 188110706353494fe7577377.98358558
)
in dblog_watchdog() (line 160 of /home/travis/build/panopoly/drupal/modules/dblog/dblog.module).</p><hr />PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in /home/travis/build/panopoly/drupal/includes/database/database.inc:2168
Stack trace:
#0 /home/travis/build/panopoly/drupal/includes/database/database.inc(2168): PDOStatement->execute(Array)
#1 /home/travis/build/panopoly/drupal/includes/database/database.inc(680): DatabaseStatementBase->execute(Array, Array)
#2 /home/travis/build/panopoly/drupal/includes/database/database.inc(2347): DatabaseConnection->query('SELECT expire, ...', Array, Array)
#3 /home/travis/build/panopoly/drupal/includes/lock.inc(167): db_query('SELECT expire, ...', Array)
#4 /home/travis/build/panopoly/drupal/includes/lock.inc(146): lock_may_be_available('schema:runtime:...')
#5 /home/travis/build/panopoly/drupal/includes/bootstrap.inc(424): lock_acquire('schema:runtime:...')
#6 /home/travis/build/panopoly/drupal/includes/bootstrap.inc(446): DrupalCacheArray->set(Array)
#7 [internal function]: DrupalCacheArray->__destruct()
#8 in /home/travis/build/panopoly/drupal/includes/database/database.inc on line 2168
PHP Stack trace:
PHP 1. {main}() /home/travis/build/panopoly/drupal/profiles/panopoly/tests/behat/vendor/behat/behat/bin/behat:0
PHP 2. Symfony\Component\Console\Application->run() /home/travis/build/panopoly/drupal/profiles/panopoly/tests/behat/vendor/behat/behat/bin/behat:32
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in /home/travis/build/panopoly/drupal/includes/database/database.inc on line 2168
Call Stack:
0.0003 241984 1. {main}() /home/travis/build/panopoly/drupal/profiles/panopoly/tests/behat/vendor/behat/behat/bin/behat:0
0.0154 1438072 2. Symfony\Component\Console\Application->run() /home/travis/build/panopoly/drupal/profiles/panopoly/tests/behat/vendor/behat/behat/bin/behat:32
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in /home/travis/build/panopoly/drupal/includes/database/database.inc on line 2168
Call Stack:
0.0003 241984 1. {main}() /home/travis/build/panopoly/drupal/profiles/panopoly/tests/behat/vendor/behat/behat/bin/behat:0
0.0154 1438072 2. Symfony\Component\Console\Application->run() /home/travis/build/panopoly/drupal/profiles/panopoly/tests/behat/vendor/behat/behat/bin/behat:32
931.8270 82666328 3. DrupalCacheArray->__destruct() /home/travis/build/panopoly/drupal/includes/bootstrap.inc:0
931.8271 82667856 4. DrupalCacheArray->set() /home/travis/build/panopoly/drupal/includes/bootstrap.inc:446
931.8272 82668160 5. lock_acquire() /home/travis/build/panopoly/drupal/includes/bootstrap.inc:424
931.8276 82689560 6. lock_may_be_available() /home/travis/build/panopoly/drupal/includes/lock.inc:146
931.8276 82690120 7. db_query() /home/travis/build/panopoly/drupal/includes/lock.inc:167
931.8276 82690512 8. DatabaseConnection->query() /home/travis/build/panopoly/drupal/includes/database/database.inc:2347
Take one: I think the solution is just explicitly shutting down the webserver (ie. drush runserver) after finishing the Behat tests. That way it's shutdown before the MySQL server.
Take two: It's got to be comming from some cleanup function which uses the Drupal API driver.
Comment | File | Size | Author |
---|---|---|---|
#19 | panopoly-mysql-server-gone-away-2231631-19.patch | 1.14 KB | dsnopek |
Comments
Comment #1
lsolesen CreditAttribution: lsolesen commentedCan we tweak mysql? https://drupal.org/node/259580.
Asked via an issue in Behat on Github: https://github.com/Behat/Behat/issues/491
Comment #3
dsnopekI've just made a commit that I hope will fix this problem!
http://drupalcode.org/project/panopoly.git/commit/0d84b3451f8cf3cb45ba41...
However, only time will tell. :-)
Comment #4
dsnopekGah! Unfortunately, this didn't fix the issue. :-/
I was assuming that this error was coming from the webserver which was still running when MySQL was already shutdown. However, on a closer look, it appears to be from 'behat' during it's shutdown process. It's got to be some cleanup function which uses the Drupal API driver.
I've updated the error in the issue description to be more detailed and show all the back traces.
Comment #5
Ari Gold CreditAttribution: Ari Gold commentedI took a look at https://travis-ci.org/openscholar/openscholar to see if they have the same problem and it didn't look like it. I wonder if adding apache2 and/or cat after_script will prevent the mysql server from going away issue?
From https://github.com/openscholar/openscholar/blob/SCHOLAR-3.x/.travis.yml
before_script:
....
- sudo apt-get install apache2
....
script:
- ./bin/behat --tags=$TEST_SUITE
after_script:
- sudo cat /var/log/apache2/error.log
Although now I looked at https://travis-ci.org/acquia/commons3 which seems to have taken the approach that's already committed as part of Panopoly's .travis.yml and they don't seem to have this issue either?
From: https://github.com/acquia/commons3/blob/7.x-3.x/.travis.yml
after_script:
# Stop the webserver so that it's not still running when MySQL is stopped.
- kill $SERVER_PID
Comment #6
dsnopekIt'd be difficult to tell if other distributions are affected because it's normal to simply re-run tests that fail with this error. We always do! And after it passes the old history about it failing is removed from Travis-CI. I know that Commerce Kickstart's tests also suffer from this issue (because @lsolesen is the one working on them ;-)).
I think if anything is to blame, it's probably the Drupal Behat Extension.
Comment #7
Ari Gold CreditAttribution: Ari Gold commentedAh, that makes sense! I was about to ask in which builds this issue is happening because I didn't see where it was still failing.
Comment #8
jhedstromI posted a possible solution here #2247461: Mysql server gone randomly after all Behat tests have run. Shutdown functions tend not to behave properly on long-running Behat runs since Drupal may be bootstrapped hundreds of times in a single run.
Comment #9
lsolesen CreditAttribution: lsolesen commentedI am trying the suggestion for #8 out on Commerce Kickstart at the moment. https://travis-ci.org/lsolesen/commerce_kickstart/builds/24240108. There is a long history o at least one of the jobs in the build history to fail from the Mysql Server Gone Away error.
https://travis-ci.org/commerceguys/commerce_kickstart/builds
UPDATE: It did not seem to do any difference https://travis-ci.org/lsolesen/commerce_kickstart/jobs/24240109#L811.
Trying another approach by disabling dblog, but that did not work either: https://travis-ci.org/lsolesen/commerce_kickstart/jobs/24241724#L815 and it does consistent in all jobs for a build it seems: https://travis-ci.org/lsolesen/commerce_kickstart/jobs/24241728#L937. However, the build actually exists with a success status: https://travis-ci.org/lsolesen/commerce_kickstart/jobs/24241724. This is a lot better than what we are experiencing now, as we can actually get a green light - and dblog isn't used at all for the tests.
Let me know if I should make a patch for this :)
UPDATE 2: Still a problem so it is not fixed: https://travis-ci.org/lsolesen/commerce_kickstart/jobs/24250542#L1010
Comment #10
lsolesen CreditAttribution: lsolesen commentedThe real problem might be, though, that MySQL's max_allowed_packet is too low. I do not know whether that can be changed anywhere in Travis? https://github.com/travis-ci/travis-ci/issues/2250
Comment #11
lsolesen CreditAttribution: lsolesen commentedJust an update: I had fairly good results for Commerce Kickstart just disabling dblog. See here https://travis-ci.org/commerceguys/commerce_kickstart/builds.
Might be worth doing before getting a lot of commits to be tested from the sprint today?
Comment #12
dsnopekThanks, Lars! I'll try and get this in at the beginning of the sprint: https://github.com/commerceguys/commerce_kickstart/compare/4032313c0ef1....
Comment #13
dsnopekI committed a change to disable dblog! Closing until we see this problem again.
Comment #14
dsnopekBlergh! This error happened on the first test. :-/
Comment #15
lsolesen CreditAttribution: lsolesen commentedDoh. However, I think the prevalence will go down. That it certainly did on CK.
Comment #17
dsnopekI haven't seen this one for a while. I'm going to close it for now - of course, I'll re-open if it recurs.
Comment #19
dsnopekAlright! I'm re-opening this unholy issue. The last fix attempted was disabling dblog, and actually, since then, I really haven't seen this error practically at all.
However, we have a test for #2423841: "Top search phrases" report not showing any data that needs dblog in order to work!
So, I'm going try an alternate fix for this. A new patch is attached!
I'm trying it on this Travis-CI build now:
https://travis-ci.org/dsnopek/panopoly/builds/52315872
Comment #20
dsnopekI also tried it with #2398347: Panopoly Magic abuses FPP revisions which was also experiencing this issue during one of its tests:
https://travis-ci.org/dsnopek/panopoly/builds/52323403
So far, it has solved the problem on each of the tests I've tried it with!
Comment #21
dsnopekCommitted!