| Project: | Drupal core |
| Version: | 7.0 |
| Component: | database system |
| Category: | bug report |
| Priority: | major |
| Assigned: | collinsfm316 |
| Status: | closed (fixed) |
| Issue tags: | database |
Issue Summary
The description below is fine for a developer but leaves an ordinary user completely in the dark. They have no clue what they should do. In this case just hitting refresh fixed things. That is what ordinary users should see. Something like
System failure. Try refreshing the screen.
------------------------------
Additional uncaught exception thrown while handling exception.
Original
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT source FROM {url_alias} WHERE alias = :alias AND language IN (:language, :language_none) ORDER BY language ASC, pid DESC; Array ( [:alias] => node/2 [:language] => en [:language_none] => und ) in drupal_lookup_path() (line 177 of /home/yktdan/public_html/includes/path.inc).
Additional
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => php [:db_insert_placeholder_2] => %type: !message in %function (line %line of %file). [:db_insert_placeholder_3] => a:6:{s:5:"%type";s:12:"PDOException";s:8:"!message";s:286:"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT source FROM {url_alias} WHERE alias = :alias AND language IN (:language, :language_none) ORDER BY language ASC, pid DESC; Array ( [:alias] => node/2 [:language] => en [:language_none] => und ) ";s:9:"%function";s:20:"drupal_lookup_path()";s:5:"%file";s:42:"/home/yktdan/public_html/includes/path.inc";s:5:"%line";i:177;s:14:"severity_level";i:3;} [:db_insert_placeholder_4] => 3 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => http://www.danielsweb.info/ [:db_insert_placeholder_7] => [:db_insert_placeholder_8] => 108.21.188.154 [:db_insert_placeholder_9] => 1297532414 ) in dblog_watchdog() (line 155 of /home/yktdan/public_html/modules/dblog/dblog.module).
Uncaught exception thrown in session handler.
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in _drupal_session_write() (line 204 of /home/yktdan/public_html/includes/session.inc).
Comments
#1
I am also facing same problem in my project. I had configured drupal 7 in my local window machine. Sometimes page become blank and by pressing F5 it comes again.
some times I found same error message in my project.
Please give me solution....
#2
Error was resolved. Refer following link
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
#3
That may make the event not happen, but it doesn't address the UX issue of telling the ordinary user what to do. All error messages should start out with advice to an ordinary user of what they should do. They can then put up more info that pertains to a system administrator, labeled as such so the ordinary user can ignore it. The other side of this coin is the obnoxious "Ask your system administrator.", but what if I am the system administrator? There are no clues about what to do next. I am sure that more info was available in the code where the error message was formatted and could have been included.
#4
Just ran into this error message the day we were launching. Urgently seeking a solution.
#5
im in the same boat! Help! called go daddy and a tacky as heck guy was playing the smart ass instead of helping....
#6
Additional uncaught exception thrown while handling exception.
Original
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 's.context' in 'field list': SELECT s.source, s.context, t.translation, t.language FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.textgroup = 'default' AND s.version = :version AND LENGTH(s.source) < :length; Array ( [:language] => es [:version] => 7.0 [:length] => 75 ) in locale() (line 641 of /home/content/e/m/p/empresarial/html/jesucristo/modules/locale/locale.module).
Additional
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 's.context' in 'where clause': 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] => es [:source] => %type: !message in %function (line %line of %file). [:context] => ) in locale() (line 659 of /home/content/e/m/p/empresarial/html/jesucristo/modules/locale/locale.module).
--------------------------------------------------------------------------------
Uncaught exception thrown in session handler.
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ssid' in 'where clause': SELECT 1 AS expression FROM {sessions} sessions WHERE ( (sid = :db_condition_placeholder_0) AND (ssid = :db_condition_placeholder_1) ) FOR UPDATE; Array ( [:db_condition_placeholder_0] => Ri-OqzL8V5-vEMMfV9Xl-fqNC4jTJiq9pIF-1QlHS4k [:db_condition_placeholder_1] => ) in _drupal_session_write() (line 204 of /home/content/e/m/p/empresarial/html/jesucristo/includes/session.inc).
--------------------------------------------------------------------------------
#7
I was able to resolve mine after updating to the current beta of the media module + banner rotation modules.
From what I understand the media module is changing rapidly. there is a chance that you auto-updated your site to a newer version of a module incompatible with your current version of the media module. thats how I got myself in trouble. : )
#8
Dear yktdan,
I understand that you want to point out the problem to drupal core developing developers but would you be so kind to tell us here what this issue is about as it seems that you are aware of the fact that the ordinary user is left in the dark. And if you know how to resolve this issue, would you please share it with us? We would all much appreciate it. Thank you.
#9
I no longer remember any details about what I was doing that caused me to get the error message, and likely at this point many months later, that particular bug is gone. My issue is purely a UX issue about how to write error messages so that all levels of users from non-techy user, to site admin user, to developer, all get messages at a level of detail that is relevant and understandable by them. This particular one, was probably only understandable by a developer.
#10
In case another is desperate to find a fast solution for this error. It can be a solution to set the max_allowed_packet value in your my.cnf or my.ini to a higher value. As default value on installation this is often set to 1 M but for a drupal 7 installation with a lot of modules this can be insufficient.
#11
where's the .cnf file located? i'm working on a localhost
#12
In case you are working with MAMP it's located in Applications/MAMP/Library/support-files/my-small.cnf . You should create a copy of the cnf file you wish to use and rename it as my.cnf and place it in the folder Applications/MAMP/Library/
And if you're looking for the php.ini file (I haven't heard of my.ini file though) you can change the settings under (again MAMP):
/Applications/MAMP/bin/php/php5.3.6/conf/php.ini
or if you are still running an older version of php:
/Applications/MAMP/bin/php/php5.2.17/conf/php.ini
Let us know if that works.
#13
It works! Thanks!
I use xampp on windows 7. Encountered the same problem.
Changed max_allowed_packet to 20M in xampp\mysql\bin\my.ini , finish.
#14
Hi,
There are also some changes need to be required in my.ini file. Please refer the attachments.
#15
Hi,
You can make the changes in code in my.ini with reference of attached patch.
#16
Here my personal experience as a non-expert, just for those who are using a shared hosting, just like I am:
I got the above error message (General error: 2006 MySQL server has gone away) last night, out of the blue (I didn't do anything to my website).
I asked my hosting service provider if I or they could change MySQL's max_allowed_packet setting in my my.cnf to a larger value. They said "No".
So I went to the control panel page for my website and backed up my database (just clicked the "backup" button).
After having checked that the backup file is there, I restored the database (by clicking the "restore" button).
After a couple of minutes my website was running again as if there hadn't been any problem at all. :)
Please note, however, that I can't guarantee that the above procedure will work for other cases.
#17
I came across the same issue and fixed it by increasing the 'max_allowed_packet' limit to '16M'
here are the steps i followed on my xampp, localhost
#18
Upping the max_allowed_packet does not work for me. I still get:
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT nt.* FROM {node_type} nt WHERE (disabled = :db_condition_placeholder_0) ORDER BY nt.type ASC; Array ( [:db_condition_placeholder_0] => 0 ) in _node_types_build() (line 703 of C:\xampp\htdocs\drupal\modules\node\node.module).
Any ideas? This is on localhost with XAMPP as well... I'm worried that even if I fix it here I'll face the same problem when I go live?
#19
hi i have the same issue but its even worst i can't access my content menu and can't run cron please help my job depends on it
Additional uncaught exception thrown while handling exception.
Original
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT uid, name, picture, data FROM {users} WHERE uid IN (:uids_4, :uids_34, :uids_35, :uids_36, :uids_37, :uids_38, :uids_39, :uids_41, :uids_42, :uids_44, :uids_55, :uids_56, :uids_57, :uids_58, :uids_59, :uids_78, :uids_79, :uids_80, :uids_81, :uids_83, :uids_85, :uids_96, :uids_97, :uids_98, :uids_101, :uids_107, :uids_110, :uids_113, :uids_120, :uids_129, :uids_135, :uids_138, :uids_140, :uids_142, :uids_143, :uids_144, :uids_150, :uids_151, :uids_152, :uids_166, :uids_167, :uids_168, :uids_173, :uids_182, :uids_183, :uids_185, :uids_186, :uids_187, :uids_188, :uids_190); Array ( [:uids_4] => 1 [:uids_34] => 1 [:uids_35] => 1 [:uids_36] => 1 [:uids_37] => 1 [:uids_38] => 1 [:uids_39] => 1 [:uids_41] => 1 [:uids_42] => 1 [:uids_44] => 1 [:uids_55] => 1 [:uids_56] => 1 [:uids_57] => 1 [:uids_58] => 1 [:uids_59] => 1 [:uids_78] => 7 [:uids_79] => 7 [:uids_80] => 7 [:uids_81] => 7 [:uids_83] => 7 [:uids_85] => 7 [:uids_96] => 7 [:uids_97] => 7 [:uids_98] => 7 [:uids_101] => 7 [:uids_107] => 7 [:uids_110] => 7 [:uids_113] => 7 [:uids_120] => 7 [:uids_129] => 7 [:uids_135] => 7 [:uids_138] => 7 [:uids_140] => 7 [:uids_142] => 7 [:uids_143] => 7 [:uids_144] => 7 [:uids_150] => 7 [:uids_151] => 7 [:uids_152] => 15 [:uids_166] => 7 [:uids_167] => 7 [:uids_168] => 7 [:uids_173] => 7 [:uids_182] => 15 [:uids_183] => 15 [:uids_185] => 15 [:uids_186] => 15 [:uids_187] => 15 [:uids_188] => 15 [:uids_190] => 15 ) in user_node_load() (line 3563 of /var/www/html/modules/user/user.module).
Additional
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: INSERT INTO {watchdog} (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array ( [:db_insert_placeholder_0] => 7 [:db_insert_placeholder_1] => php [:db_insert_placeholder_2] => %type: !message in %function (line %line of %file). [:db_insert_placeholder_3] => a:6:{s:5:"%type";s:12:"PDOException";s:8:"!message";s:1843:"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT uid, name, picture, data FROM {users} WHERE uid IN (:uids_4, :uids_34, :uids_35, :uids_36, :uids_37, :uids_38, :uids_39, :uids_41, :uids_42, :uids_44, :uids_55, :uids_56, :uids_57, :uids_58, :uids_59, :uids_78, :uids_79, :uids_80, :uids_81, :uids_83, :uids_85, :uids_96, :uids_97, :uids_98, :uids_101, :uids_107, :uids_110, :uids_113, :uids_120, :uids_129, :uids_135, :uids_138, :uids_140, :uids_142, :uids_143, :uids_144, :uids_150, :uids_151, :uids_152, :uids_166, :uids_167, :uids_168, :uids_173, :uids_182, :uids_183, :uids_185, :uids_186, :uids_187, :uids_188, :uids_190); Array ( [:uids_4] => 1 [:uids_34] => 1 [:uids_35] => 1 [:uids_36] => 1 [:uids_37] => 1 [:uids_38] => 1 [:uids_39] => 1 [:uids_41] => 1 [:uids_42] => 1 [:uids_44] => 1 [:uids_55] => 1 [:uids_56] => 1 [:uids_57] => 1 [:uids_58] => 1 [:uids_59] => 1 [:uids_78] => 7 [:uids_79] => 7 [:uids_80] => 7 [:uids_81] => 7 [:uids_83] => 7 [:uids_85] => 7 [:uids_96] => 7 [:uids_97] => 7 [:uids_98] => 7 [:uids_101] => 7 [:uids_107] => 7 [:uids_110] => 7 [:uids_113] => 7 [:uids_120] => 7 [:uids_129] => 7 [:uids_135] => 7 [:uids_138] => 7 [:uids_140] => 7 [:uids_142] => 7 [:uids_143] => 7 [:uids_144] => 7 [:uids_150] => 7 [:uids_151] => 7 [:uids_152] => 15 [:uids_166] => 7 [:uids_167] => 7 [:uids_168] => 7 [:uids_173] => 7 [:uids_182] => 15 [:uids_183] => 15 [:uids_185] => 15 [:uids_186] => 15 [:uids_187] => 15 [:uids_188] => 15 [:uids_190] => 15 ) ";s:9:"%function";s:16:"user_node_load()";s:5:"%file";s:38:"/var/www/html/modules/user/user.module";s:5:"%line";i:3563;s:14:"severity_level";i:3;} [:db_insert_placeholder_4] => 3 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => http://www.icare.com/admin/content [:db_insert_placeholder_7] => http://www.icare.com/admin/modules [:db_insert_placeholder_8] => 173.162.124.90 [:db_insert_placeholder_9] => 1340815281 ) in dblog_watchdog() (line 157 of /var/www/html/modules/dblog/dblog.module).
Uncaught exception thrown in session handler.
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in _drupal_session_write() (line 206 of /var/www/html/includes/session.inc).
#20
@ #19 : Try truncating "cache_update" table in the database. It worked for me.
#21
hey thanks for the reply i found out the node i created gave me an error and the only way to fix it it was going inside the database phpmyadmin and erase that node as for the error i think it happened because i dropped a couple of images through ckeditor and after that couldnt access the content area
#22
#2 : Here is the direct link to the post http://madhavvyas.blogspot.fr/2011/04/sqlstatehy000-general-error-2006-mysql.html
And it worked for me, thank you madhavvyas ;)
#23
I'm running into this rather frequently in trying to do a site re-build on my test server (virtual install of Ubuntu running LAMPP). All I am doing at this point is enabling modules at this point, so I've been wondering if there is a timing (memory) issue going on somewhere. I know there used to be a tweak I had to do for my installs of XAMPP when I was running that on my Windows machine to resolve oddball memory issues. Even worse, I can't find my notes on this as it has been such a long time since I've run into this since going to the virtual install. I could have sworn it involved modifying the .htaccess file found in the Drupal root directory, but I don't see that in these installs for Drupal 7.
Oh, and just doing a refresh of the page is NOT getting rid of the error as someone indicated at the top of this issue report.
#24
#2 #22
It worked for me, too.
add following line in /etc/my.cnf (CentOS 5.8)
max_allowed_packet = 128M
thank you very much, madhavvyas and seren10pity ;)
#25
using MAMP, do no works for me, problem stills
i am getting crazy with this error ¡¡¡
#26
I guess I'm dealing with something different than most users. The errors I am getting always start with this:
PDOException: SQLSTATE[HY000]: General error: 145 Table '.\field_revision_body' is marked as crashed and should be repaired:
PDOException: SQLSTATE[HY000]: General error: 145 Table '.\field_revision_body' is marked as crashed and should be repaired:
Repairing the table in question always produces a fix thru PHPAdmin, until it strikes again. Again, as this is occurring on my test server I still feel it to be some sort of memory/timing issue where the MySQL server glitches during the save. In any case, as this is still on my test server I can certainly try madhavvyas idea to see if it helps any.
My biggest concern is that if this is still going on once the site is fully re-built in Drupal 7 and moved out to the production site, where users will be interacting with it. I have been tracking these errors for a while now and it does seem to always involve that one table too. Yes, the Revision module is used on this site to provide moderation so this all could tie back to that rather than the Drupal core. That is, if it really is the fault of any code and not an issue with the MySQL server configuration.
#27
I have this error:
Additional uncaught exception thrown while handling exception.
Original
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT * FROM {commerce_flat_rate_service}; Array ( ) in commerce_flat_rate_commerce_shipping_service_info() (line 120 of C:\xampp\htdocs\comercio\profiles\commerce_kickstart\modules\contrib\commerce_flat_rate\commerce_flat_rate.module).
Additional
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT ff.* FROM {filter_format} ff WHERE (status = :db_condition_placeholder_0) ORDER BY weight ASC; Array ( [:db_condition_placeholder_0] => 1 ) in filter_formats() (line 409 of C:\xampp\htdocs\comercio\modules\filter\filter.module).
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\comercio\includes\session.inc).
#28
Hello, I'm a very new user
I've solved this ERROR ("Additional uncaught exception thrown while handling exception") it because my problem was that when I tried to IMPORT my DATA BASE from PHPmyAdmin using the free hosting 000webhost it imported only SOME tables but not ALL of them (I don't know why) so I resolved it exporting my data base in 2 files and then I imported them from PHPmyAdmin. I used de bzip format because another problem was that if I didn't compressed the file of my DB the IMPORT didn't worked.
Note: AAA DON'T FORGET TO CHANGE THE "SETTINGS.PHP" FILE TO CHANGE DE SERVER FIELDS OF COURSE!
Hope this comment is usefull
cheers
#29
how to fix this problem with having cpanel access only?
#30
I'm using LAMP (Ubuntu 12:04) as my development environment. I solved the problem by:
Open a terminal window and run:
sudo gedit /etc/mysql/my.cnfFind the line that reads '
max_allowed_packet = 16M'Modify so that the line reads '
max_allowed_packet = 128M' (I read earlier in the thread however that anything above 48M for this setting would be okay).Save changes to my.cnf and close gedit
Restart mysql with command:
sudo /etc/init.d/mysql restartorsudo service mysql restartAnyone know a cleaner method? I'm always excited to learn!!!
#31
Thank you so!! Good solution for me ;-)
*****
Muchas gracias!! Buena solucion para mi ;-)
#32
Thanks madhavvyas - resolving the 206 error as per http://madhavvyas.blogspot.com/ worked for me too. It may be worth pointing out for anyone using MAMP PRO you make the change by going MAMP PRO > File > Edit Template > MySQL my.cnf and making the change there.
#33
#30 and #32 worked for me. THANKS!!!
#34
Hi. I'm using XAMPP on windows 7 but also facing same problem in my project. I had configured drupal 7 in my local window machine and working localhost
*************************************************************************************
Additional uncaught exception thrown while handling exception.
Original
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {trigger_assignments} trigger_assignments) subquery; Array ( ) in trigger_menu_unassign_access() (line 92 of C:\xampp\htdocs\leas\modules\trigger\trigger.module).
Additional
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT ff.* FROM {filter_format} ff WHERE (status = :db_condition_placeholder_0) ORDER BY weight ASC; Array ( [:db_condition_placeholder_0] => 1 ) in filter_formats() (line 409 of C:\xampp\htdocs\leas\modules\filter\filter.module).
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\leas\includes\session.inc).
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] => 891197515512ec606cc0af4.11303133 ) in lock_release_all() (line 269 of C:\xampp\htdocs\leas\includes\lock.inc).
#35
Error 2006 is very common in Drupal 7 but not a problem with the build as some speculate.
Symptoms:
Original
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: DELETE FROM {cache} WHERE (cid LIKE :db_condition_placeholder_0 ESCAPE '\\') ; Array ( [:db_condition_placeholder_0] => entity\_info:% ) in cache_clear_all() (line 163 of D:\wamp\www\dev7\includes\cache.inc).
Additional
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT filename FROM {registry} WHERE name = :name AND type = :type; Array ( [:name] => OgMembershipTypeUIController [:type] => interface ) in _registry_check_code() (line 3091 of D:\wamp\www\dev7\includes\bootstrap.inc).
Primary Problem:
1) The server timed out and closed the connection which is the most common cause.
Solutions to Problem 1:
1) The first thing to check is the wait_timeout variable in the my.cnf or my.ini config file. You may need to increase the time for it to work. By just increasing the memory allocation may allow more data through-put but may not provide enough time window for the data to be processed. You may try setting the wait_timeout to about 600 seconds and adjust it even higher once error 2006 has vanished. When you restart mysql the wait_timeout should be near 28800 seconds or just about 8 hours or so.
2) The server might have received a package of data too large to process which is the second common problem. The best way to resolve this common problem is to go into the my.cnf or my.ini files and change the max_allowed_packet to 64M and that should resolve the problem. It is best to do both in order to resolve this issue.
#36
I use Vertrigo
Open file ..\VertrigoServ\Mysql\mi.ini
Config my.ini
----------------------------------
[mysqld]
basedir=F:\VertrigoServ\Mysql\
datadir=F:\VertrigoServ\Mysql\data\
port =3306
key_buffer =16M
max_allowed_packet =32M
table_cache =64
sort_buffer_size =512K
net_buffer_length =8K
read_buffer_size =256K
read_rnd_buffer_size =512K
myisam_sort_buffer_size =8M
[mysqldump]
quick
max_allowed_packet =32M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[isamchk]
key_buffer =20M
sort_buffer_size =20M
read_buffer =2M
write_buffer =2M
[myisamchk]
key_buffer =20M
sort_buffer_size =20M
read_buffer =2M
write_buffer =2M
[mysqlhotcopy]
interactive-timeout
----------------------------------