+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 22

Thread: MySQL error :MySQL Connection Failed: Lost connection to MySQL server during query

  1. #1

    MySQL error :MySQL Connection Failed: Lost connection to MySQL server during query

    I have just recently upgraded my boards from UBB 5.46 to vBulletin 2.2.1. A number of users have noted that they are periodically receiving the following error :

    Warning: Lost connection to MySQL server during query in /home/chris/sites/eclipseforums/htdocs/admin/db_mysql.php on line 40

    Warning: MySQL Connection Failed: Lost connection to MySQL server during query in /home/chris/sites/eclipseforums/htdocs/admin/db_mysql.php on line 40

    I also receive this same error when attempting to rebuild the search index.

    I am on a dedicated tbird 1.2ghz box with 1Gig of RAM, running openBSD 2.9, apache 1.3.22, mySQL 3.23.41, and php 4.0.6.

    the url to my forums is http://www.eclipseforums.org
    we generally have between 80 - 130 users online during normal times.

    my my.cnf file is as follows:


    # The MySQL server
    [mysqld]
    port = 3306
    socket = /tmp/mysql.sock
    skip-locking
    set-variable = max_connections=400
    set-variable = key_buffer=32M
    set-variable = join_buffer=4M
    set-variable = record_buffer=4M
    set-variable = sort_buffer=8M
    set-variable = thread_cache_size=128
    set-variable = max_allowed_packet=4M
    set-variable = table_cache=1024
    set-variable = net_buffer_length=8K
    set-variable = myisam_sort_buffer_size=64M
    log-bin
    server-id = 1

    [mysqldump]
    quick
    set-variable = max_allowed_packet=16M

    [mysql]
    no-auto-rehash
    # Remove the next comment character if you are not familiar with SQL
    #safe-updates

    [isamchk]
    set-variable = key_buffer=20M
    set-variable = sort_buffer=20M
    set-variable = read_buffer=2M
    set-variable = write_buffer=2M

    [myisamchk]
    set-variable = key_buffer=20M
    set-variable = sort_buffer=20M
    set-variable = read_buffer=2M
    set-variable = write_buffer=2M

    [mysqlhotcopy]
    interactive-timeout


    and the extended status output -


    tech1# ./mysqladmin extended-status
    +--------------------------+------------+
    | Variable_name | Value |
    +--------------------------+------------+
    | Aborted_clients | 0 |
    | Aborted_connects | 3 |
    | Bytes_received | 103182638 |
    | Bytes_sent | 1257018188 |
    | Connections | 26305 |
    | Created_tmp_disk_tables | 13 |
    | Created_tmp_tables | 22734 |
    | Created_tmp_files | 0 |
    | Delayed_insert_threads | 0 |
    | Delayed_writes | 0 |
    | Delayed_errors | 0 |
    | Flush_commands | 1 |
    | Handler_delete | 2284 |
    | Handler_read_first | 15803 |
    | Handler_read_key | 4742455 |
    | Handler_read_next | 10005450 |
    | Handler_read_prev | 0 |
    | Handler_read_rnd | 4131468 |
    | Handler_read_rnd_next | 32942751 |
    | Handler_update | 58705 |
    | Handler_write | 1199529 |
    | Key_blocks_used | 12198 |
    | Key_read_requests | 21021592 |
    | Key_reads | 4321 |
    | Key_write_requests | 677753 |
    | Key_writes | 606072 |
    | Max_used_connections | 16 |
    | Not_flushed_key_blocks | 0 |
    | Not_flushed_delayed_rows | 0 |
    | Open_tables | 88 |
    | Open_files | 115 |
    | Open_streams | 0 |
    | Opened_tables | 101 |
    | Questions | 586697 |
    | Select_full_join | 13 |
    | Select_full_range_join | 0 |
    | Select_range | 112696 |
    | Select_range_check | 0 |
    | Select_scan | 68513 |
    | Slave_running | OFF |
    | Slave_open_temp_tables | 0 |
    | Slow_launch_threads | 0 |
    | Slow_queries | 3 |
    | Sort_merge_passes | 0 |
    | Sort_range | 95874 |
    | Sort_rows | 4304724 |
    | Sort_scan | 42359 |
    | Table_locks_immediate | 629613 |
    | Table_locks_waited | 560 |
    | Threads_cached | 16 |
    | Threads_created | 17 |
    | Threads_connected | 1 |
    | Threads_running | 1 |
    | Uptime | 13001 |
    +--------------------------+------------+


    Please help if possible, thanks
    Last edited by Chris3G; Wed 5th Dec '01 at 7:32pm.

  2. #2
    anybody? suggestions??

  3. #3
    vBulletin Developer Freddie Bingham is just really nice Freddie Bingham is just really nice Freddie Bingham is just really nice Freddie Bingham is just really nice Freddie Bingham is just really nice Freddie Bingham's Avatar
    Join Date
    May 2000
    Location
    California
    Age
    36
    Posts
    14,014
    Blog Entries
    16
    need to see the variables 'show variables' from mysql or phpmyadmin.
    vBulletin Developer since Dec 2000

  4. #4
    is this what you need?


    Variable_name | Value |
    +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
    | back_log | 50 |
    | basedir | /usr/local/mysql/ |
    | binlog_cache_size | 32768 |
    | character_set | latin1 |
    | character_sets | latin1 dec8 dos german1 hp8 koi8_ru latin2 swe7 usa7 cp1251 danish hebrew win1251 estonia hungarian koi8_ukr win1251ukr greek win1250 croat cp1257 latin5 |
    | concurrent_insert | ON
    || connect_timeout | 5

    || datadir | /usr/local/mysql/var/

    || delay_key_write | ON

    || delayed_insert_limit | 100

    || delayed_insert_timeout | 300

    || delayed_queue_size | 1000

    || flush | OFF

    || flush_time | 0

    || have_bdb | NO

    || have_gemini | NO

    || have_innodb | NO

    || have_isam | YES

    || have_raid | NO

    || have_ssl | NO

    || init_file |

    || interactive_timeout | 28800

    || join_buffer_size | 4190208

    || key_buffer_size | 33550336

    || language | /usr/local/mysql/share/mysql/english/

    || large_files_support | ON

    || locked_in_memory | OFF

    || log | OFF

    || log_update | OFF

    || log_bin | ON

    || log_slave_updates | OFF

    || log_long_queries | OFF

    || long_query_time | 10

    || low_priority_updates | OFF

    || lower_case_table_names | 0


    | max_allowed_packet | 8387584

    || max_binlog_cache_size | 4294967295

    || max_binlog_size | 1073741824

    || max_connections | 400

    || max_connect_errors | 10

    || max_delayed_threads | 20

    || max_heap_table_size | 16777216

    || max_join_size | 4294967295

    | max_sort_length | 1024

    || max_user_connections | 0

    || max_tmp_tables | 32

    || max_write_lock_count | 4294967295

    || myisam_recover_options | 0

    || myisam_max_extra_sort_file_size | 256

    || myisam_max_sort_file_size | 2047


    || myisam_sort_buffer_size | 67108864

    || net_buffer_length | 7168

    || net_read_timeout | 30

    || net_retry_count | 10

    || net_write_timeout | 60

    || open_files_limit | 0

    || pid_file | /usr/local/mysql/var/tech1.pid

    || port | 3306

    |

  5. #5
    | protocol_version | 10 |
    | record_buffer | 4190208 |
    | record_rnd_buffer | 4190208 |
    | query_buffer_size | 0 |
    | safe_show_database | OFF |
    | server_id | 1 |
    | slave_net_timeout | 3600 |
    | skip_locking | ON |
    | skip_networking | OFF |
    | skip_show_database | OFF |
    | slow_launch_time | 2 |
    | socket | /tmp/mysql.sock |
    | sort_buffer | 8388600 |
    | sql_mode | 0 |
    | table_cache | 681 |
    | table_type | MYISAM |
    | thread_cache_size | 128 |
    | thread_stack | 65536 |
    | transaction_isolation | READ-COMMITTED |
    | timezone | EST |
    | tmp_table_size | 33554432 |
    | tmpdir | /tmp/ |
    | version | 3.23.41-log |
    | wait_timeout | 28800 |
    +---------------------------------+--------------------------------------------

  6. #6
    It seems to be getting more frequent

  7. #7
    vBulletin Team eva2000 will become famous soon enough eva2000's Avatar
    Join Date
    May 2000
    Location
    Brisbane, Australia
    Posts
    29,953
    simple remove these 2 lines from /etc/my.cnf file and restart mysql
    log-bin
    server-id = 1
    _
    * Required server info for server performance issues here
    * Choosing right cpus for high concurrency vB servers

    => Xeon Westmere 56xx > Xeon Nehalem-EP 55xx > Xeon 54xx > Xeon 53xx
    => vB4 FAQ | vB 4 Features | vB4 Style Info | Internet brand Message
    => IBxAnders vB4.0 Search & InnoDB | InnoDB conversion | Large forums drive configs!

  8. #8
    im still having trouble with this i've removed those lines from my config, and have also tried different config files. I am currently using this -

    [mysqld]
    skip-locking
    set-variable = key_buffer=32M
    set-variable = join_buffer=6M
    set-variable = record_buffer=6M
    set-variable = sort_buffer=8M
    set-variable = table_cache=1024
    set-variable = max_connections=300
    set-variable = thread_cache_size=128

    It was fine all day, and then the errors suddenly began again. It does not seem to be related to the amount of traffic on the site.

    I have also tried using persistant connections to the db, which seemed to make the problem worse. When using persistant connections, the error was in line 38 rather than line 40.
    Last edited by Chris3G; Thu 6th Dec '01 at 8:05pm.

  9. #9
    vBulletin Team eva2000 will become famous soon enough eva2000's Avatar
    Join Date
    May 2000
    Location
    Brisbane, Australia
    Posts
    29,953
    okay can you please provide the your most current mysql extended-status output either still telnet as root user type

    mysqladmin -u root -p extended-status

    copy and paste output here

    or preferred is to installed extended-status output script which is located at http://vbulletin.com/forum/showthread.php?threadid=3477

    and post url to that here

    is your vB the only thing on the server? or other scripts? sites?

    if you can post the url to that script since it gives me a live status of your mysql usage on the server - if you can take a snapshot of the output prior to or close to before getting the error that would be helpful

    you can also tail or look into your mysql error file in your mysql data directory to see what the problem is
    _
    * Required server info for server performance issues here
    * Choosing right cpus for high concurrency vB servers

    => Xeon Westmere 56xx > Xeon Nehalem-EP 55xx > Xeon 54xx > Xeon 53xx
    => vB4 FAQ | vB 4 Features | vB4 Style Info | Internet brand Message
    => IBxAnders vB4.0 Search & InnoDB | InnoDB conversion | Large forums drive configs!

  10. #10
    http://www.eclipseforums.org/stat.php

    there are a few other small sites running on the server (3 or 4) but they generate almost no traffic. Other than that, mail and dns services, vbulletin is the only thing running.

  11. #11
    vBulletin Team eva2000 will become famous soon enough eva2000's Avatar
    Join Date
    May 2000
    Location
    Brisbane, Australia
    Posts
    29,953
    Originally posted by Chris3G
    http://www.eclipseforums.org/stat.php

    there are a few other small sites running on the server (3 or 4) but they generate almost no traffic. Other than that, mail and dns services, vbulletin is the only thing running.
    you mysql queries/second seem to be average but you have alot of connections/second to mysql

    what other scripts are running? are you using persistent connections ?
    _
    * Required server info for server performance issues here
    * Choosing right cpus for high concurrency vB servers

    => Xeon Westmere 56xx > Xeon Nehalem-EP 55xx > Xeon 54xx > Xeon 53xx
    => vB4 FAQ | vB 4 Features | vB4 Style Info | Internet brand Message
    => IBxAnders vB4.0 Search & InnoDB | InnoDB conversion | Large forums drive configs!

  12. #12
    There is nothing else running. Im not using persistant connections, but i have tried using them. It seemed to make the problem worse, after a few minutes of persistant connections being enabled i would get so many "Lost Connection during query" errors that i had to switch back.

  13. #13
    also, i had to restart my server this morning, and my site is just now beginning to reach it's average amount of traffic for the day ( ~100 users), so the stat.php script may possiby provide more pertinant information now than earlier this morning.

  14. #14
    vBulletin Team eva2000 will become famous soon enough eva2000's Avatar
    Join Date
    May 2000
    Location
    Brisbane, Australia
    Posts
    29,953
    Originally posted by Chris3G
    also, i had to restart my server this morning, and my site is just now beginning to reach it's average amount of traffic for the day ( ~100 users), so the stat.php script may possiby provide more pertinant information now than earlier this morning.
    can you post your top memory stats or install this script http://phpsysinfo.sourceforge.net/ to see your top memory usage stats..

    mysql seems to be fine you seem to have 108 people

    There are currently 82 members and 26 guests on the boards

    and using 12 max connections in use..

    the only thing i can see is a pretty high connections/second to mysql..

    try grabbing the last 100 entries from your mysql.err file in your mysql data directory

    by typing as root user

    tail -100 /path/to/servernameerrorlog.err

    paste it into a txt file and attach it here
    _
    * Required server info for server performance issues here
    * Choosing right cpus for high concurrency vB servers

    => Xeon Westmere 56xx > Xeon Nehalem-EP 55xx > Xeon 54xx > Xeon 53xx
    => vB4 FAQ | vB 4 Features | vB4 Style Info | Internet brand Message
    => IBxAnders vB4.0 Search & InnoDB | InnoDB conversion | Large forums drive configs!

  15. #15
    i tried running that script but it claims not to support openbsd at this time

    here is the top memory output
    Memory: Real: 118M/191M act/tot Free: 815M Swap: 4K/300M used/tot


    and vmstat
    procs memory page disks faults cpu
    r b w avm fre flt re pi po fr sr c0 w0 in sy cs us sy id
    1 4 0 113212 842280 778 0 0 0 0 0 0 15 315 4709 373 17 3 80

    and the error log

    tech1# tail -100 tech1.err
    011206 18:50:53 /usr/local/mysql/libexec/mysqld: Normal shutdown

    011206 18:50:53 /usr/local/mysql/libexec/mysqld: Shutdown Complete

    011206 18:50:53 mysqld ended

    011206 18:51:37 mysqld started
    011206 18:51:37 Warning: setrlimit returned ok, but didn't change limits. Max o
    pen files is 1772
    011206 18:51:37 Warning: Changed limits: max_connections: 300 table_cache: 731

    /usr/local/mysql/libexec/mysqld: ready for connections
    011206 19:14:04 Error in accept: Bad file descriptor
    011206 19:40:16 Error in accept: Bad file descriptor
    011206 19:45:39 Error in accept: Bad file descriptor
    011206 19:48:33 Error in accept: Bad file descriptor
    011206 20:25:47 /usr/local/mysql/libexec/mysqld: Binlog closed, cannot RESET MA
    STER

    Status information:

    Current locks:
    lock: 178e8c:

    key_cache status:
    blocks used: 24578
    not flushed: 0
    w_requests: 0
    writes: 0
    r_requests: 0
    reads: 0

    handler status:
    read_key: 0
    read_next: 0
    read_rnd 0
    read_first: 0
    write: 0
    delete 0
    update: 0

    Table status:
    Opened tables: 0
    Open tables: 0
    Open files: 0
    Open streams: 0
    011206 20:26:47 /usr/local/mysql/libexec/mysqld: Normal shutdown

    011206 20:26:48 /usr/local/mysql/libexec/mysqld: Shutdown Complete

    011206 20:26:48 mysqld ended

    011206 20:26:52 mysqld started
    011206 20:26:52 Warning: setrlimit returned ok, but didn't change limits. Max o
    pen files is 1772
    011206 20:26:52 Warning: Changed limits: max_connections: 300 table_cache: 731

    /usr/local/mysql/libexec/mysqld: ready for connections
    011206 22:01:58 Error in accept: Bad file descriptor
    011206 22:06:34 Error in accept: Bad file descriptor
    011206 22:32:27 Error in accept: Bad file descriptor
    011206 22:45:28 Error in accept: Bad file descriptor
    011206 22:54:34 Error in accept: Bad file descriptor
    011206 23:22:21 Error in accept: Bad file descriptor
    011206 23:37:33 Error in accept: Bad file descriptor
    011206 23:40:55 Error in accept: Bad file descriptor
    011207 1:01:18 Error in accept: Bad file descriptor
    011207 1:29:00 Error in accept: Bad file descriptor
    011207 08:07:36 mysqld started
    011207 8:07:37 Warning: setrlimit returned ok, but didn't change limits. Max o
    pen files is 1772
    011207 8:07:37 Warning: Changed limits: max_connections: 300 table_cache: 731

    /usr/local/mysql/libexec/mysqld: ready for connections
    011207 8:57:16 read_const: Got error 134 when reading table ./vbulletin/post
    011207 8:57:17 read_const: Got error 134 when reading table ./vbulletin/post
    011207 8:57:20 read_const: Got error 134 when reading table ./vbulletin/post
    011207 8:57:21 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:02:20 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:02:26 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:02:45 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:06:49 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:09:04 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:09:31 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:09:40 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:20:25 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:20:29 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:20:30 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:24:56 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:25:18 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:25:39 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:25:45 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:29:01 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:33:23 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:34:07 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:34:10 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:34:52 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:35:33 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:35:37 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:35:38 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:35:40 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:35:41 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:40:27 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:47:37 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:47:43 read_const: Got error 134 when reading table ./vbulletin/post
    011207 9:47:47 read_const: Got error 134 when reading table ./vbulletin/post
    011207 10:16:31 Error in accept: Bad file descriptor
    tech1#



    the errors at the end are due to a corrupted table which occured when the server locked up this morning.

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. mysql error: Lost connection to MySQL server during query since upgrading to 2.2.5
    By f150guy in forum vBulletin 2 'How Do I' and Troubleshooting
    Replies: 4
    Last Post: Mon 23rd Oct '06, 12:55am
  2. Lost connection to MySQL server during query
    By dolphin in forum vBulletin 2 'How Do I' and Troubleshooting
    Replies: 1
    Last Post: Wed 17th Sep '03, 10:35am
  3. MySQL error :MySQL Connection Failed: Lost connection to MySQL server during query
    By The Piper in forum vBulletin 2 'How Do I' and Troubleshooting
    Replies: 2
    Last Post: Tue 30th Apr '02, 12:48am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts