Linux Sysadmin Blog

Drupal Watchdog Error

- | Comments

One of our Drupal sites suddenly had this ”blank page” problem after user login.  So we turned on the PHP’s error reporting and got the ”allowed memory size of xxx bytes exhausted” error.  Usually this error is caused by memory limit for PHP so you just need to increase it from your php.ini file or _.htaaccess, _ but in our case we had our memory limit set already to 64Mb.   Check here for more details on how to increase PHP memory limit.

Upon further investigation, we found out that it was caused by a bug on our Watchdog module as we got ”Warning: Got a packet bigger than ‘max_allowed_packet’ bytes query: INSERT INTO watchdog (uid, type, message, variables…”.  You can fix this error by increasing MySQL’s max_allowed_packet (the default i think is 16MB).  You can do it directly from your my.cnf, add ”set-variable = max_allowed_packet=32M” (of course without qoutes :)) and restart you MySQL server. If you want to set this value temporarily, you can do it by logging in to your MySQL prompt and issue ”SET GLOBAL max_allowed_packet=32M;”.  You can check your current configuration by this command ”mysqladmin variables | grep packet”.  We set our max_allowed_packet to 32MB and our site went back to normal.

The reason why we experienced that error is because we originally had the max_allowed_packet set 32M temporarily and we rebooted our server so it returned to the default value.