Not sure what I did, but I'd love some advice to make this one go away - thanks!

user warning: Got a packet bigger than 'max_allowed_packet' bytes query: UPDATE cache_menu SET data = 'a:932:{s:4:\"node\";a:26:{s:5:\"title\";s:7:\"Content\";s:13:\"page callback\";s:17:\"node_page_default\";s:16:\"access arguments\";a:1:{i:0;s:14:\"access content\";}s:4:\"type\";i:4;s:6:\"module\";s:4:\"node\";s:14:\"load_functions\";s:0:\"\";s:16:\"to_arg_functions\";s:0:\"\";s:6:\"weight\";i:0;s:13:\"_number_parts\";i:1;s:6:\"_parts\";a:1:{i:0;s:4:\"node\";}s:4:\"_fit\";i:1;s:8:\"_visible\";b:1;s:4:\"_tab\";b:0;s:10:\"tab_parent\";s:0:\"\";s:8:\"tab_root\";s:4:\"node\";s:15:\"access callback\";s:11:\"user_access\";s:14:\"page arguments\";a:0:{}s:14:\"block callback\";s:0:\"\";s:15:\"title arguments\" in /usr/home/hoslo/public_html/includes/cache.inc on line 109.

Comments

WorldFallz’s picture

searching with some portion of the error message often yields useful results. See:

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

jamestombs’s picture

I had this problem whenever I enabled views.

Turned out that max_allowed_packet was set 1M in MySQL. Increasing this to 8MB sorted the problem.

James T
Action Medical Research - www.action.org.uk

James T
Action Medical Research - www.action.org.uk

snorkers’s picture

Not nowing much about the workings of MySQL, found that if I ran the following query (via phpMyAdmin) then I could change the value (note syntax of bytes value):

SET GLOBAL max_allowed_packet=16*1024*1024;

If doing this via shell, use (again note format of bytes value):

mysql --max_allowed_packet=16M

There's probably a more permanent way of doing this, but beyond my skillset, alas. Either way, it prevented the MySQL error occuring.

gpk’s picture

A useful tip :)

Unfortunatly you need the SUPER privilege to do that, so won't help many on shared hosts.

Also one can check the current value with SHOW VARIABLES LIKE 'max_allowed_packet'. Happily my host has set it to about 32M :D

gpk
----
www.alexoria.co.uk

cayenne’s picture

How do I make the warning go away? I don't mean fixing the problem, I just mean go away!

:)

gpk’s picture

if you go to Administer -> Site configuratoin -> Error reporting you can stop warnings and errors from displaying on the screen. They will still be logged though.

gpk
----
www.alexoria.co.uk

cayenne’s picture

Turned out the core problem for me was that a database table had gotten lost. Fixed that and the error went away.

:)

loze’s picture

What table? How did you fix that?
Im having the same problem

thanks

cayenne’s picture

In my case, the problem was that the cache_view table was missing after a site migration. The clue to the problem was found in the error message which, albeit in messed-up code, included something like "table not found" or something.

I think that it'd be smart before a migration to truncate all the cache tables. Lots of non-needed data that makes the system cranky.

:)

kevster111’s picture

so how did you fix the cache view table. Just curious. I know this is an old post too.

Online Batman fan site and Community http://www.batmantrailer.net

gpk’s picture

One way would be to copy an empty table of the same name from another site. Or copy, then empty, if you prefer.

escoles’s picture

This is not accurate. Since this is a PHP error, you need to disable error reporting in php.ini -- disabling it in Drupal is not sufficient.

gpk’s picture

A couple of other workarounds:
1. Use a different caching module/mechanism (e.g. one that uses files)
2. Run the query SET SESSION max_allowed_packet=16*1024*1024; on each pageview (e.g. in hook_init()).

gpk
----
www.alexoria.co.uk

dafreak’s picture

I don't understand. hook_init()? init() is a hook in each module. Are we supposed to put a db_query('SET SESSION max_allowed_packet=16*1024*1024;') in every module?! Isn't there anywhere the MySQL session variables are set on session initialization? This is crazy. Why do the packets get so large? Shouldn't the data be packetized into smaller chunks?
I've tried putting the query in db_connect(), doesn't fix it. _db_query(), no luck. I don't get it. Can't believe someone hasn't squashed this bug before.

Still FREAKIN'!! #^&^%$%^&^ :-)

gpk’s picture

>Where do you mean in hook_init()?

In a tiny custom module.
e.g. put query in function fix_mysql_packet_size_init() in fix_mysql_packet_size.module. Would also need a .info file.

gpk
----
www.alexoria.co.uk

ainigma32’s picture

It explains how to make such a module.

- Arie

gpk’s picture

ainigma32’s picture

Totally forgot to post the link LOL

- Arie

gpk’s picture

:P

snorkers’s picture

A little off topic, but relevant to my original post...
How do you tweak MySQL parameters on the standard (pre-installed) Leopard installation of MySQL? I cannot seem to find the right my.cnf file anywhere? Any clues? Or should I be looking in php.ini??
Getting fed up running this query on my MPB after every reboot.

davidcgutman’s picture

I don't know about you, but I found that tweaking the Leopard settings made things far too complicated - just use MAMP (free download from mamp.info). Makes things much simpler.

willyk’s picture

Note that on the Leopard Server admin, the config files are located off root at etc/my.cnf and etc/php.ini ... they are hidden by default, so unless you are using CLI you have to adjust you visibility settings like so:

http://www.macworld.com/article/51830/2006/07/showallfinder.html

Not sure if all this is the same on OSX, but I believe that it is.

thisgeek’s picture

My 10.5 Mac did not have an /etc/my.cnf file, but I created one and added this:

[mysqld]
max_allowed_packet=50M

and then restarted the mysql server:

sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart

That seems to have fixed the problem.

cookiesunshinex’s picture

This totally worked for me!

webulite’s picture

If you go to the file; database.mysqli.inc in the folder /includes

and search for this line;

trigger_error(check_plain(mysqli_error($active_db) ."\nquery: ". $query), E_USER_WARNING);

it occurs at about line 134

and simply comment it out, by changing it to this

// trigger_error(check_plain(mysqli_error($active_db) ."\nquery: ". $query), E_USER_WARNING);

you will solve the problem.

Cheers! Ricco

gpk’s picture

Hmmm I suspect that might suppress all database errors, which might or might not be what most people want/need.. ;)

kolyapatrik’s picture

It was solve the problem!

sibany’s picture

Cheers m8! you saved me lots of work :D

Thanks!

zach harkey’s picture

If you are using MAMP PRO, you have to access the my.cnf file through the MAMP application menu:

MAMP PRO > File > Edit template > MySQL my.cnf

Screenshot of MAMP PRO MySQL my.cnf

Then Stop / Start MAMP.

: z

sumitk’s picture

This worked for me .. thanks for sharing

rossmerriam’s picture

This solution solved my problem on an installation of Open Publish

kenorb’s picture

kay_v’s picture

The following will increase the limit:

  1. copy /Applications/MAMP/Library/share/mysql/my-small.cnf
  2. name it (and put it in directory) as /Applications/MAMP/db/mysql/my.cnf
  3. change 'max_allowed_packet = 1M' to the required value
  4. in the MAMP application, click stop servers, then restart them

VM's comment is also very worth looking over for a broader understanding of what's going on.

and of course grab a copy of The Definitive Guide to Drupal 7 for more tips on setting up your development environment, among other topics.

ownsourcing.com - Drupal training

dravidian7’s picture

repairing the cache_menu table in phpMyAdmin worked for me.