Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /data/home/qyu2722550001/htdocs/wp-includes/cron.php on line 280

自己弄的一个博客,是用wordpress搭建的。一开始用的挺好,后来登录后台操作时,偶尔会出现类似下面的错误:

null

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /data/home/*******/htdocs/wp-includes/cron.php on line 280

一开始不在意,后来的两年中随着时间的推移,出现的越来越频繁。中间试着找过原因,但由于对PHP不了解,一直没找到问题根源。这几天又出现了类似的问题,我根据提示定位到了wp-includes/cron.php on line 280,即cron.php的第280行,这一行是建立一个数组,存储目前系统的计划任务的关键字信息,导致了内存分配失败。

我把注意力放到了“计划任务”上,搜索相关信息,知道了wordpress会定期执行一些计划任务,如果执行失败会反复的执行,如果积累了很多的定时任务,每次操作,都会触发去执行一遍未执行的任务。

会不会是系统有很多的计划任务在等待执行,每次我操作后台,就会触发一次执行,任务太多导致消耗很多内存?

那么,如何查看当前有多少任务呢?我找到了一个插件:wp-cron-dashboard,安装-启用,在工具-里打开,发现确实有很多任务:

Overview of tasks scheduled for WP-Cron

Anytime after 2016年1月9日 @am5:54 execute tasks
Entry #1: duoshuo_sync_log_cron X no action exists with this name
Anytime after 2016年1月9日 @am5:56 execute tasks
Entry #2: do_this_auto_daily X no action exists with this name
Anytime after 2016年1月9日 @am5:56 execute tasks
Entry #3: do_this_auto_daily X no action exists with this name
Anytime after 2016年1月9日 @am5:57 execute tasks
Entry #4: do_this_auto_daily X no action exists with this name
Anytime after 2016年1月9日 @am5:58 execute tasks
Entry #5: do_this_auto_daily X no action exists with this name
Anytime after 2016年1月9日 @am5:59 execute tasks
Entry #6: do_this_auto_daily X no action exists with this name
Anytime after 2016年1月9日 @am5:59 execute tasks
Entry #7: do_this_auto_daily X no action exists with this name
Anytime after 2016年1月9日 @am6:00 execute tasks
Entry #8: do_this_auto_daily X no action exists with this name
Anytime after 2016年1月9日 @am6:01 execute tasks
Entry #9: do_this_auto_daily X no action exists with this name
……
有大概好2万6千多条,天啊,怪不得会内存耗尽。
© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容