I am loading xmlsitemap for the first time on a large site. I use the 'Rebuild' tab for initial creation. The sitemap was built containing 1,262 URLs. The process bar was at 80% when the Rebuild failed issuing "An error occurred. /batch?id=21&op=do". The status report indicates:
Cached files have not been generated yet.
The XML sitemap data is out of sync and needs to be completely rebuilt.

The module was enabled overnight and cron failed with:
Cron run exceeded the time limit and was aborted.
Cron also fails when started manually.

Sitemap is enabled for three content types on the site. Sitemap, custom and node modules are enabled. I have not created any custom links.

Comments

Greg Sims’s picture

I disabled custom and the behavior appears the same.

andrewfn’s picture

I am getting exactly the same. And now every cron run fails with "exceeded the time limit and was aborted"

dave reid’s picture

Status: Active » Postponed (maintainer needs more info)

Could I have both of you go to admin/reports/status/php on your site and report back the following values:
memory_limit
max_execution_time

Also if you can lookup your server's timeout as well (for Apache servers it's usually in httpd.conf)

andrewfn’s picture

PHP memory limit 64M
max_execution_time 30 (although cron aborts within less than a second)

from httpd.conf:
Timeout 120

Also, I added the cron debugging line into my modules.inc to log every cron hit. Here is the result (obviously newest events at the top)

cron 5:10pm Cron run exceeded the time limit and was aborted. Anonymous
cron 5:10pm hit xmlsitemap cron Anonymous
cron 5:10pm hit xmlsitemap_taxonomy cron Anonymous
cron 5:10pm hit xmlsitemap_node cron Anonymous
cron 5:10pm hit xmlsitemap_menu cron Anonymous
cron 5:10pm hit ad_cache_file cron Anonymous
cron 5:10pm hit ad cron Anonymous
cron 5:10pm hit update cron Anonymous
cron 5:10pm hit system cron Anonymous
cron 5:10pm hit statistics cron Anonymous
cron 5:10pm hit search cron Anonymous
cron 5:10pm hit node cron Anonymous
cron 5:10pm hit filter cron Anonymous
cron 5:10pm hit dblog cron Anonymous
cron 5:10pm hit googleanalytics cron Anonymous
cron 5:10pm hit date_timezone cron Anonymous

Greg Sims’s picture

memory_limit = 96M
max_execution_time = 30

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 120

I am also seeing an immediate abort of cron so the timeouts don't seem to be a factor here.

andrewfn’s picture

I made a clone of the site and gradually removed things to see what was causing the problem.
I deleted every node and removed every non-core module except xmlsitemap and the problem was still there!
The server is a standard CentOS 5.4 running php 5.16
(I am using the current Acquia distribution).

Anonymous’s picture

Does the following command show anything interesting? Cron didn't timeout because it runs for 240 seconds before timing out. Maybe a database lock issue?

mysqladmin processlist -u root -p

Greg Sims’s picture

I performed a SHOW PROCESSLIST. It only has one entry which is the process of the SHOW PROCESSLIST request itself.

andrewfn’s picture

Status: Postponed (maintainer needs more info) » Active

I performed a SHOW PROCESSLIST. It only has one entry which is the process of the SHOW PROCESSLIST request itself.

Same for me

andrewfn’s picture

Steps to reproduce:
-create new drupal 6.16 installation
-add xmlsitemap 6.x-2.x-dev (today's version)
-enable just the xmlsitemap
-try and rebuild links and it will fail

Server is a stock Centos 5.4 (which uses php 5.16)
The apc accelerator is installed

andrewfn’s picture

I ran the same steps as above on another server which has the CentOS customized so that php 5.26 is installed
No error!

dave reid’s picture

Can you try disabling APC on the PHP 5.16 server? Can you check the server's error logs?

andrewfn’s picture

Looked at the httpd error_log
Now we are getting somewhere!

PHP Fatal error: Call to undefined function memory_get_peak_usage() in /opt/dr6/jazz/trunk/modules/xmlsitemap/xmlsitemap.generate.inc on line 140

dave reid’s picture

Ah indeed. I can fix that. :)

srobert72’s picture

Same error. Subscribing.

dave reid’s picture

Status: Active » Fixed

Committed a fix to CVS. Feel free to retest from CVS or whenever the dev build is repackaged.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

andrewfn’s picture

Version: 6.x-2.0-alpha2 » 6.x-2.x-dev
Status: Closed (fixed) » Active

The problem has re-appeared with a different error in the apache log:

PHP Fatal error: Call to undefined method XMLSitemapWriter::writeRaw() in /modules/xmlsitemap/xmlsitemap.xmlsitemap.inc on line 58

I am using php 5.1.6

andrewfn’s picture

After googling around for a solution, I found this code which provides a fallback method for writeRaw when running under php 5.1.6. I added it to end of the class XMLSitemapWriter in xmlsitemap.xmlsitemap.inc and it works perfectly--XML sitemaps will now build.

   /**
     * Fallback method for writeRaw, introduced in PHP 5.2
     *
     * @param string $text
     * @return string
     */
    public function writeRaw($text)
    {
    	if (method_exists($parent, 'writeRaw')) {
    		return $parent->writeRaw($text);
    	}

   	return $this->text($text);
    }
andrewfn’s picture

Status: Active » Needs review
StatusFileSize
new640 bytes

Here is a patch for the above code

andrewfn’s picture

Title: Rebuild Fail with "An error occurred. /batch?id=21&op=do" » hangs under php 5.1 with cron time exceeded or rebuild fail

Renaming issue to a more accurate and informative title

srobert72’s picture

Same errors since fews days :

Cron run exceeded the time limit and was aborted.
Last cron process did not finish.

But I use PHP 5.2.4.

dave reid’s picture

Title: hangs under php 5.1 with cron time exceeded or rebuild fail » PHP 5.1 does not have XMLWriter::writeRaw()
StatusFileSize
new3.07 KB
andrewfn’s picture

Tested on several servers and it works for me.

Remon’s picture

Status: Needs review » Reviewed & tested by the community
dave reid’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.