( ! ) Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKBase.class.php on line 114
Call Stack
#TimeMemoryFunctionLocation
10.0002413864{main}( ).../index.php:0
20.11224272656Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.392513066464Joomla\CMS\Application\SiteApplication->render( ).../CMSApplication.php:202
40.392613066408Joomla\CMS\Application\SiteApplication->render( ).../SiteApplication.php:778
50.392713066784Joomla\CMS\Document\HtmlDocument->parse( ).../CMSApplication.php:1030
60.392713066784Joomla\CMS\Document\HtmlDocument->_fetchTemplate( ).../HtmlDocument.php:545
70.392813066880Joomla\CMS\Document\HtmlDocument->_loadTemplate( ).../HtmlDocument.php:730
80.393213104512require( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/component.php' ).../HtmlDocument.php:668
90.397413395192GKTemplate->__construct( ).../component.php:31
100.410313536712GKTemplateMenu->getMenuType( ).../gk.framework.php:84
110.411113580976require_once( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKMenu.php' ).../helper.menu.php:19

( ! ) Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKHandheld.php on line 76
Call Stack
#TimeMemoryFunctionLocation
10.0002413864{main}( ).../index.php:0
20.11224272656Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.392513066464Joomla\CMS\Application\SiteApplication->render( ).../CMSApplication.php:202
40.392613066408Joomla\CMS\Application\SiteApplication->render( ).../SiteApplication.php:778
50.392713066784Joomla\CMS\Document\HtmlDocument->parse( ).../CMSApplication.php:1030
60.392713066784Joomla\CMS\Document\HtmlDocument->_fetchTemplate( ).../HtmlDocument.php:545
70.392813066880Joomla\CMS\Document\HtmlDocument->_loadTemplate( ).../HtmlDocument.php:730
80.393213104512require( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/component.php' ).../HtmlDocument.php:668
90.397413395192GKTemplate->__construct( ).../component.php:31
100.413313703720GKTemplateMenu->getMenuType( ).../gk.framework.php:85
[ERROR] /usr/libexec/mysqld: Can't open file: './xxx/xxxxxxxxx.frm' (errno: 24)
Logo
Print this page

[ERROR] /usr/libexec/mysqld: Can't open file: './xxx/xxxxxxxxx.frm' (errno: 24)

my.cnf

innodb_open_files=1024

open_files_limit=5000

 

 

 mysql -uroot -pXXXXX

 

1,显示当前系统的文件限制
# cat /proc/sys/fs/file-max
调整参考:http://hi.baidu.com/loveyoursmile/blog/item/e26b550fed89ff226059f3c4.html

2,通过phpmyadmin查询mysql配置参数(既open files limit)。
一般情况下,mysql 5的open files limit会自动根据table cache调整。open files limit 系统默认调整为table cache的2倍多一点。

 

 

I go the following errors in a database:

091030 0:23:46 [ERROR] /usr/sbin/mysqld-max: Can't open file: './register/member.frm' (errno: 24)
091030 0:23:46 [ERROR] /usr/sbin/mysqld-max: Can't open file: './register/description.frm' (errno: 24)

This is related to file descriptors.

# perror 24
OS error code  24:  Too many open files

I enlarge the value of open_files_limit by adding a line in my.cnf.

open_files_limit=5000

For open_files_limit, please refer this link:

http://cherry.world.edoors.com/CozM0IXYA-fc

For more explanation about this error, please refer this page:

B.5.2.18. 'File' Not Found and Similar Errors
http://dev.mysql.com/doc/refman/5.0/en/not-enough-file-handles.html

 

 

how to calculate open file limit?
(发表日期: 2009-8-23 11:39am, 总访问量: 1412, 今天访问: 1, 本周访问: 6, 本月访问: 19)

每打开一个MyISAM表,就需要使用2个文件描述符,咱们来验证一下MySQL如何计算打开文件数。

一、试验
从手册的"6.4.8. How MySQL Opens and Closes Tables"可以了解到,每打开一个MyISAM表,就需要使用2个文件描述符,咱们来验证一下。
1. 重启mysqld
/etc/init.d/mysql restart
2. 看看打开了几个文件
lsof | grep /home/mysql 
... 
mysqld 24349 mysql 5u unix 0x000001041e8de040 4244009 /home/mysql/mysql.sock 
mysqld 24349 mysql 6u REG 8,33 2048 30425188 /home/mysql/mysql/host.MYI 
mysqld 24349 mysql 7u REG 8,33 0 30425189 /home/mysql/mysql/host.MYD 
mysqld 24349 mysql 8u REG 8,33 2048 30425153 /home/mysql/mysql/user.MYI 
mysqld 24349 mysql 9u REG 8,33 892 30425155 /home/mysql/mysql/user.MYD 
mysqld 24349 mysql 10u REG 8,33 5120 30425126 /home/mysql/mysql/db.MYI 
mysqld 24349 mysql 11u REG 8,33 3080 30425148 /home/mysql/mysql/db.MYD 
mysqld 24349 mysql 12u REG 8,33 4096 30425154 /home/mysql/mysql/tables_priv.MYI 
mysqld 24349 mysql 13u REG 8,33 0 30425157 /home/mysql/mysql/tables_priv.MYD 
mysqld 24349 mysql 14u REG 8,33 4096 30425143 /home/mysql/mysql/columns_priv.MYI 
mysqld 24349 mysql 15u REG 8,33 0 30425156 /home/mysql/mysql/columns_priv.MYD 
mysqld 24349 mysql 16u REG 8,33 4096 30425127 /home/mysql/mysql/procs_priv.MYI 
mysqld 24349 mysql 17u REG 8,33 0 30425136 /home/mysql/mysql/procs_priv.MYD 
mysqld 24349 mysql 18u REG 8,33 1024 30425173 /home/mysql/mysql/servers.MYI 
mysqld 24349 mysql 19u REG 8,33 0 30425174 /home/mysql/mysql/servers.MYD 
mysqld 24349 mysql 20u REG 8,33 2048 30425182 /home/mysql/mysql/event.MYI 
mysqld 24349 mysql 21u REG 8,33 0 30425183 /home/mysql/mysql/event.MYD 
...    

可以看到,总共打开了8个表,每个表分别有2个文件描述符,看来没错。 

3. 再来看 status 结果 

mysql>show global status like 'open_%'; 
+------------------------+-------+ 
| Variable_name | Value | 
+------------------------+-------+ 
| Open_files | 17 | 
| Open_streams | 0 | 
| Open_table_definitions | 15 | 
| Open_tables | 8 | 
| Opened_files | 52 | 
| Opened_tables | 15 | 
+------------------------+-------+ 

4. flush tables 后再看看
mysql>flush tables; 
mysql> show global status like 'open_%'; 
+------------------------+-------+ 
| Variable_name | Value | 
+------------------------+-------+ 
| Open_files | 1 | 
| Open_streams | 0 | 
| Open_table_definitions | 0 | 
| Open_tables | 0 | 
| Opened_files | 52 | 
| Opened_tables | 15 | 
+------------------------+-------+ 
lsof | grep /home/mysql 
... 
mysqld 24349 mysql 5u unix 0x000001041e8de040 4244009 /home/mysql/mysql.sock 
mysqld 24349 mysql 22u unix 0x00000102378ff980 4244128 /home/mysql/mysql.sock 
... 

可以看到,flush 之后,所有的文件描述符都释放了。
通过测试可以得知,另一个打开的文件描述符是 slow query log所用。
如果是有大量的 MyISAM 表,那么就需要特别注意打开文件数是否会超出限制了。 

二、原理

接下来仔细了解下这个最大文件数相关的参数:
table_cache (新版本改成了 table_open_cache) The number of cached open tables.
open_files_limit If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit().
If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger)
number of files.
如果 open_files_limit 不是设置为 0,则以 setrlimit() 函数计算后的结果为准,如果设置为 0,则实际值是 max_connections*5 或 max_connections + table_cache*2 中的最大者。
因此,想要解决打开文件数超限的问题,还需要综合系统内核限制(ulimit -n),mysqld自身限制(open_files_limit),以及表缓存数(table_open_cache)等多方面因素。
不过,实际测试中,发现却不是这样的,open_files_limit采用了内核的最大限制,而非上面的计算结果。
1. 查看内核限制
ulimit -n
65535
2. 修改 my.cnf 限制
vi /etc/my.cnf 
... 
open_files_limit = 10000 
... 

3. 重启 mysqld
/etc/init.d/mysql restart
4. 查看结果
mysql>show global variables like '%open%'; 
| open_files_limit | 65535 | 
| table_open_cache | 1000 | 

5. 不设置 open_files_limit 看看
vi /etc/my.cnf 
... 
#open_files_limit = 10000 
... 
重启 
/etc/init.d/mysql restart 
查看 
mysql>show global variables like '%open%'; 
| open_files_limit | 65535 | 
| table_open_cache | 1000 | 

而这个时候,按计算公式结果如下:
| max_connections | 100 |
| table_open_cache | 1000 |
来计算一下:
max_open_files_1 = max_connections + table_cache * 2 = 100 + 1000 * 2 = 2100
max_open_files_2 = max_connections*5 = 100 * 5 = 500
6. 修改 ulimit 试试看:
unlimit -n 5000 
vi /etc/my.cnf 
... 
open_files_limit = 10000 
... 
/etc/init.d/mysql restart 
mysql>show global variables like '%open%'; 
| open_files_limit | 10000 | 
| table_open_cache | 1000 | 

open_files_limit 比内核最大限制数还大,因此以 open_files_limit 为准。 
vi /etc/my.cnf 
... 
#open_files_limit = 10000 
... 
/etc/init.d/mysql restart 
mysql>show global variables like '%open%'; 
| open_files_limit | 5000 | 
| table_open_cache | 1000 | 

看到了,变成了新的内核最大限制
看到了吧,结果完全跟文档描述的以及mysql源码中写的不一样,看来预编译版本有些地方不太可靠啊 :(
以上测试在mysql 5.1.23-rc(预编译), mysql-5.1.24-rc(自编译) 以及 5.0.45(预编译) 均一样。
uname -a 
Linux s1.yejr.com 2.6.9-55.ELsmp #1 SMP Fri Apr 20 16:36:54 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux 
mysql> select version(); 
+---------------+ 
| version() | 
+---------------+ 
| 5.1.23-rc-log | 
+---------------+ 

转载自 http://bbs.bbsgood.com/post_20_123433_1.html

Last modified onSaturday, 05 January 2013 13:09

( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169
Call Stack
#TimeMemoryFunctionLocation
10.0003405656{main}( ).../index.php:0
20.04001323856Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.04001323856Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.17482982272Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.17553006760Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.17653062088Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.17653079144require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.18343223232K2ControllerItem->execute( ).../k2.php:64
90.18343223232K2ControllerItem->display( ).../BaseController.php:710
100.18983492312K2ControllerItem->display( ).../item.php:78
110.18983492312K2ControllerItem->display( ).../controller.php:19
120.19123510832Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.19323531248K2ViewItem->display( ).../ViewController.php:102
140.24604158000K2ViewItem->display( ).../view.html.php:742
150.24604158000K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.24824332400include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701
  • Published in MYSQL
  • Read 1755 times

( ! ) Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478
Call Stack
#TimeMemoryFunctionLocation
10.0003405656{main}( ).../index.php:0
20.04001323856Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.04001323856Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.17482982272Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.17553006760Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.17653062088Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.17653079144require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.18343223232K2ControllerItem->execute( ).../k2.php:64
90.18343223232K2ControllerItem->display( ).../BaseController.php:710
100.18983492312K2ControllerItem->display( ).../item.php:78
110.18983492312K2ControllerItem->display( ).../controller.php:19
120.19123510832Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.19323531248K2ViewItem->display( ).../ViewController.php:102
140.24604158000K2ViewItem->display( ).../view.html.php:742
150.24604158000K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.24824332400include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701
Template Design © Joomla Templates | GavickPro. All rights reserved.