Drupal 7: Uncaught exception, MySQL server has gone away

After upgrading to Drupal 7.4 I got the following error when trying to load /admin/modules:

Additional uncaught exception thrown while handling exception.

Original

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT s.lid, t.translation, s.version FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.source = :source AND s.context = :context AND s.textgroup = 'default'; Array ( [:language] => sv [:source] => No tokens available. [:context] => ) in locale() (line 676 of /home/.../modules/locale/locale.module).

Additional

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT s.lid, t.translation, s.version FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.source = :source AND s.context = :context AND s.textgroup = 'default'; Array ( [:language] => sv [:source] => %type: !message in %function (line %line of %file). [:context] => ) in locale() (line 676 of /home/.../modules/locale/locale.module).

Uncaught exception thrown in session handler.

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in _drupal_session_write() (line 203 of /home/.../includes/session.inc)

This problem - "MySQL server has gone away" - can happen if the query you send to the MySQL server is too large. Indeed, for me the problem went away when I raised MySQL's max_allowed_packet setting from 1M (default) to 16M in my my.cnf:

[mysqld]
...
max_allowed_packet=16M

2011-07-13 ·

blog comments powered by Disqus