当前位置

Drupal中遇到超时报错的问题

James Qi 在 2011年10月8日 - 14:23 提交

  我们不少Drupal搭建的网站数据量都很巨大,遇到一些不太常见的问题,例如导入数据的过程中遇到以下报错提示:

出现错误。 /admin/content/node_import/3/continue { "status": 1, "message": "40 rows imported\x3cbr /\x3e0 rows with errors", "percentage": 10 }<br /> <b>Fatal error</b>: Maximum execution time of 60 seconds exceeded in <b>/mnt/gb2/htdocs/drupal.youbianku.com/includes/cache.inc</b> on line <b>33</b><br />

  上个月在运行cron的时候也遇到类似提示:

Fatal error: Maximum execution time of 240 seconds exceeded in /mnt/gb2 docs/drupal.mingluji.com/includes/database.inc on line 225

  当时尝试了修改php的设置(可以修改php.ini、.htaccess或程序中加set_time_limit(0);这三种办法),但报错依然,查了网上的资料,需要修改Drupal中的程序。于是修改了includes/common.inc,将其中的@set_time_limit(240);改为@set_time_limit(360);就没有报这样的错了,后来又遇到Squid的报错:

错误

您所请求的网址(URL)无法获取

当尝试读取以下网址(URL)时: http://114.mingluji.com/admin/reports/status/run-cron

发生了下列的错误:

Read Timeout
读取超时
系统回应:

[No Error]
A Timeout occurred while waiting to read data from the network. The network or server may be down or congested. Please retry your request.
当通过网络读取数据时,超过了等待时限。 可能是因为网络堵塞或连接的网络服务器已关闭。请重新尝试。

  修改Squid的配置文件后,终于解决了这个问题。

  这次是导入的时候遇到问题,采用上面的办法无法解决,后来在drupal.org上找到一篇文章,需要修改node_import.inc,将1007行删除或者注释或者修改那个60:

set_time_limit(variable_get('node_import:set_time_limit', 60));

  我这样修改后就可以继续导入而不报错了。

自由标签:

评论

  很长时间没有更新drupal 网站的sitemap了,近期用drush xmlsitemap-regenerate命令来批量更新,但在遇到数据量大的网站时,有时会遇到类似这样的报错:

Fatal error: Maximum execution time of 240 seconds exceeded in /mnt/gb2/htdocs/drupal.mingluji.com/includes/path.inc on line 115
Drush command terminated abnormally due to an unrecoverable error.                                                   [error]

  有时是includes/path.inc报错,有时是includes/common.inc,sites/all/modules/xmlsitemap/xmlsitemap.module等,网上查了一些资料,试着改了php.ini、.htaccess、common.inc、mysql.inc、locale.inc、modules/node/node.module等程序中的时间限制设置,到都没有效果,最后修改sites/all/modules/xmlsitemap/xmlsitemap.module中的这个才解决:

// Attempt to increase the execution time.
//jamesqi2013-1-10  xmlsitemap_set_time_limit(240);
  xmlsitemap_set_time_limit(1800);

  这里把240秒的限制改成了1800秒。(补充:改为1800秒后基本上都可以解决,但有一些多语言网站,在生成多达50种语言的站点地图时依然会报告1800秒超时,高干脆改为24000秒,就都不会再报超时错了。)

  另外,如果发现'Unknown error occurred while writing to file sites'、'XMLSitemapGenerationException'这样的报错,可以修改xmlsitemap.xmlsitemap.inc的第161行,把

if (!$this->getStatus()) {

  改为

if (!$return) {

  就可以了。

James Qi / 祁劲松

添加新评论

Plain text

  • 不允许使用HTML标签。
  • 自动将网址与电子邮件地址转变为链接。
  • 自动断行和分段。