crashfix内存耗尽解决

windows上最近遇到crashfix服务器异常,图标页面出先如下报错:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 51 bytes) in C:\xampp\htdocs\crashfix\protected\framework\db\ar\CActiveRecord.php on line  1866

然后找到对应代码,通过record一词感觉是crash记录过多如下:

crashfix memory exhausted

因为数据库是php工作的命脉,PHP代码的工作的上下文是通过数据库提供的,所以猜测只要把crashfix的数据库清空就好了。通过分析php代码,找到下图的代码处,并加上部分测试代码,进而得到crashfix使用的mysql数据库的用户名、密码都是 crashfix

echo $this->getDbConnection()->connectionString;
echo “<br>”
echo $this->getDbConnection()->username;
echo “<br>”
echo $this->getDbConnection()->password;
echo “<br>”

crashfix memory exhausted

 

然后通过mysql连接到crashfix的数据库:

mysql -ucrashfix -pcrashfix;

查询所有数据库,发现存在名为crashfix的数据库,应该就是需要处理的数据库,查询所有数据库的sql代码如下:

show databases;

查询所有数据库表,列出的数据表就是后面需要执行清空操作的数据表,列出数据表的sql代码如下:

select table_name from information_schema.tables;

首先先备份数据,留下后路,备份的命令行代码如下(需要在命令行中执行)

mysqldump -ucrashfix -pcrashfix crashfix tbl_appversion > E:\tbl_appversion.sql

mysqldump -ucrashfix -pcrashfix crashfix tbl_bug > E:\tbl_bug.sql

mysqldump -ucrashfix -pcrashfix crashfix tbl_bug_attachment > E:\tbl_bug_attachment.sql

mysqldump -ucrashfix -pcrashfix crashfix tbl_debuginfo > E:\tbl_debuginfo.sql

mysqldump -ucrashfix -pcrashfix crashfix tbl_fileitem > E:\tbl_fileitem.sql

mysqldump -ucrashfix -pcrashfix crashfix tbl_stackframe > E:\tbl_stackframe.sql

mysqldump -ucrashfix -pcrashfix crashfix yiicache > E:\yiicache.sql

mysqldump -ucrashfix -pcrashfix crashfix tbl_crashgroup > E:\tbl_crashgroup.sql

然后删除数据表的内容(千万不要删除表结构,那样你会发现crashfix提示找不到表而不能工作),要删除的表的选择,我是靠感觉的(手动滑稽),sql代码如下:

delete from tbl_appversion;
delete from tbl_bug;
delete from tbl_bug_attachment;
delete from tbl_debuginfo;
delete from tbl_fileitem;
delete from tbl_stackframe;
delete from yiicache;
delete from tbl_crashgroup;

后来发现tbl_crashgroup和tbl_stackframe和tbl_stackframe 比较大,可能删除这些表就行了,当然开始时也可以通过sql语句select来看下哪个表比较大。

相关文章:

  • 2022-12-23
  • 2021-11-07
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
  • 2021-10-11
  • 2022-01-15
  • 2021-08-28
猜你喜欢
  • 2022-12-23
  • 2021-11-04
  • 2021-08-06
  • 2022-01-01
  • 2022-12-23
  • 2021-12-08
相关资源
相似解决方案