Problem

When enabling a commerce module the following error is thrown. I'm unable to get past it or solve. Both times I've been forced to revert to backup. - Note. This doesn't happen on a clean install, however I've not altered core on my production site and I need help debugging/fixing.

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT COUNT(cid) FROM {comment} WHERE status = :status; Array ( [:status] => 0 ) in comment_count_unpublished() (line 314 of C:\XAMPP\htdocs\drupal4\modules\comment\comment.module).

Uncaught exception thrown in shutdown function.
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] => 10137416452290c54845001.20860842 ) in lock_release_all() (line 269 of C:\XAMPP\htdocs\drupal4\includes\lock.inc).


Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in C:\XAMPP\htdocs\drupal4\includes\database\database.inc:2168 Stack trace: #0 C:\XAMPP\htdocs\drupal4\includes\database\database.inc(2168): PDOStatement->execute(Array) #1 C:\XAMPP\htdocs\drupal4\includes\database\database.inc(680): DatabaseStatementBase->execute(Array, Array) #2 C:\XAMPP\htdocs\drupal4\includes\database\database.inc(2347): DatabaseConnection->query('SELECT expire, ...', Array, Array) #3 C:\XAMPP\htdocs\drupal4\includes\lock.inc(167): db_query('SELECT expire, ...', Array) #4 C:\XAMPP\htdocs\drupal4\includes\lock.inc(146): lock_may_be_available('schema:runtime:...') #5 C:\XAMPP\htdocs\drupal4\includes\bootstrap.inc(424): lock_acquire('schema:runtime:...') #6 C:\XAMPP\htdocs\drupal4\includes\bootstrap.inc(446): DrupalCacheArray->set(Array) #7 [internal function]: DrupalCacheArray->__destruct() #8 {main} thrown in C:\XAMPP\htdocs\drupal4\includes\database\database.inc on line 2168
Uncaught exception thrown in session handler.

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in _drupal_session_write() (line 209 of C:\XAMPP\htdocs\drupal4\includes\session.inc).

Environment

XAMPP
Windows 7
Drupal 7.23

Set-up

I've now had this twice in a row.

1. I enabled all the modules except payment UI, and both tax modules. I then created a product and a product display. I went back and enabled Payment UI module and the error was thrown.

2. I did the same thing but enabled all except the Customer UI and both tax modules, created the product, product display, then went back and enabled Customer UI and the error threw.

The only two related modules I have installed are Address Field and Commerce PayPal.

This doesn't happen on a clean install of Drupal, however I've not altered core in my production site and it keeps happening. I was hoping someone could provide advice on how to debug this.

Comments

splitsplitsplit’s picture

Solved

The problem was solved by increasing the max_allowed_packet to 128M in my my.ini file.

For anyone else who's using XAMPP and finds this, my.ini is not the same as:

my-huge.ini
my-large.ini
my-medium.ini
my-small.ini

Search in your MySQL folder for my.ini and change that one. Changing any of the ones above will do nothing.

rszrama’s picture

Category: bug » support
Priority: Major » Normal
Status: Active » Closed (fixed)

Glad you got it fixed. Thanks for sharing the solution.

spencerhudson’s picture

Many thanks for the reminder ... i had set max_allowed_packet to 128MB earlier in the day but inbetween all the other work it was reset back to 1MB. So checking it once again made all the difference.

:)

gadnis’s picture

to be clear:

change the line max_allowed_packet to 128M:
Ex.: max_allowed_packet 128M

in these files:

xamp/mysql/my.ini
xamp/my-huge.ini
xamp/my-large.ini
xamp/my-medium.ini
xamp/my-small.ini

Be sure and do it for twice, cause sometimes my.ini files resets the changes.

Then, stop the MySQL on XAMP control panel and start it again. You're done. Wellcome!