I do hate those "sometimes" issues but I'm afraid this one only happens sometimes and I haven't found any logic yet, as and when it happens or what causes it.
We're hosting 20 domains at the moment and all of them use the sitemap module. It's usually working very well. Once or twice a week though, one of those sitemaps appears to be empty - reported by Google webmaster tools.
When I then go to the server, all the files in the xmlsitemap directory are available and if I open them in an editor, they appear to be OK. However, if I want to open them in the browser with http://www.domain.com/sitemap.xml I also get an empty page with a warning that no element was found.
At that point - I guess as a side effect - my Drupal session get's closed and I have to login again.
To repair this issue I have repaired databse tables, cleared cache, and what else. Doing this several times, at some point the sitemap then comes back and works fine. But I don't exactly know which of the actions is finally fixing my issue. Nor do I know what was causing it.
Even worse, there is nothing in the logfile. So I have no idea where to look next.
Any help is much appreciated.
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | xmlsitemap_links_table-2.txt | 18.19 KB | wayland76 |
| #28 | xmlsitemap_links_table.d5.patch | 17.15 KB | Freso |
| #25 | xmlsitemap_links_table.d5.patch | 17.14 KB | Freso |
| #22 | xmlsitemap_links_table.txt | 16 KB | wayland76 |
| #8 | xmlsitemap-5.x-1.4.jh1_.patch | 15.67 KB | jurgenhaas |
Comments
Comment #1
jurgenhaasJust went through some heavy debugging and I haven't found the issue yet but here is a sequence of functions that have been invoked before the thing failed:
hit xmlsitemap cron
_xmlsitemap_ping
_xmlsitemap_link_count
_xmlsitemap_links
hit xmlsitemap xmlsitemap_links
hit xmlsitemap xmlsitemap_links
hit xmlsitemap_node xmlsitemap_links
hit xmlsitemap_term xmlsitemap_links
hit xmlsitemap_node xmlsitemap_links
hit xmlsitemap xmlsitemap_links
hit xmlsitemap_node xmlsitemap_links
hit xmlsitemap_term xmlsitemap_links
After that it just fails and I haven't figured yet exactly where this happens.
Comment #2
jurgenhaasOK, now I found it, it's this line
array_multisort($nid, $loc, $links);in
function xmlsitemap_node_xmlsitemap_links($type = NULL, $excludes = array())inxmlsitemap_node.moduleLooks like either something is wrong in the array to be sorted or the system runs out of resources because the array is too big? No idea, any suggestions?
Comment #3
jurgenhaas...and if I disable this line array_multisort... then it fails at this line
$count = isset($count) ? $count : count(_xmlsitemap_links());in xmlsitemap.module where I can say that _xmlsitemap_links() finishes completely, so that we know that the function count() fails.Comment #4
darren ohSounds like the array can be too big for your system. We may need to use a database table instead.
Comment #5
jurgenhaasYes, maybe. Although it's a pretty powerful server with 5GB RAM. The domain failing is having 150.000 nodes and we add a couple of thousands a day. Can we somehow help to get this done with a table quickly? Just because this is something in production and I don't want to upset Google with an empty sitemap.
Comment #6
darren ohComment #7
jurgenhaasVersion 1.4 doesn't make any difference. Unfortunately.
Comment #8
jurgenhaasThe last couple of days I've worked on the attached patch to make the module work with a database table instead of an array. It seems to work pretty well. Looking forward to some feedback.
Comment #9
darren ohThe patch has too much unrelated code to review.
Comment #10
jurgenhaasWhat do you mean, can you please a bit more specific? I think all the code is problem specific.
Comment #11
darren ohMaybe some of the code is for problems specific to your site. The patch needs to be limited to replacing the array with a database table.
Comment #12
jurgenhaasWell no. It's only 2 lines (gss location problem: first block) and (multi domain support: first line in third block). Everything else is related to the current problem.
Comment #13
darren ohThe patch needs to be cleaned up to be ready for review. If it's working for you, you can wait until I have time to do it.
Comment #14
druvision commentedMe too.
Got the error
Subscribing.
Amnon
-
Professional: Drupal Israel | Drupal Development & Consulting | Eco-Healing | Effective Hosting Strategies | בניית אתרים
Personal: Hitech Dolphin: Regain Simple Joy :)
Comment #15
ashtronaut commentedComment #16
ashtronaut commentedI have the same error. . . . .
XML Parsing Error: no element found
Location: http://mypetstreet.com/sitemap.xml
Line Number 1, Column 1:
Any ideas???
Comment #17
zombiee08 commentedSame error : XML Parsing error. I tried the patch but still the same error.
The issue seems to be the way XML is rendered. There are 2 junk characters that are present at the start of the XML. Due to this the browser throws an exception in parsing the XML. Since the starting XML tags should not have any thing before that.
I tried :
- changing the encoding but that does not solve the purpose.
- tried extracting the XML from the gzip using gzread and then displaying it. did not solve the purpose
- manually extracted the XML and pointed the code to open the XML instead of the gzip.
- read another small XML from the same path.
- without any encoding it gives complete XML data without the nodes. On viewing the source one can see the XML but if I select all using cntrl + A and paste somewhere it shows 2 junk characters.
The following is the error i got on different browsers
Mozilla :XML Parse error
IE7 :Page cannot be displayed
IE6 :Blank Page
Opera :Some junk Characters
Please also look into this issue, it might be the reason why parsing problem occurs
Comment #18
ik2xnw commentedThat happens to me when i'm not logged in.
When logged out, i exit and re-open the browser in order to meet the problem.
Comment #19
ashtronaut commentedThe solution in #18 did not work for me at all. The post in #17 is consistent with my problem. The weird thing is, I can see a sitemap on my development machine (localhost), but once I post this to the live server, I get the xml parsing error and blank pages etc. I have read through other posts and tried to re-create the xmlsitemap folder, as well as change the permissions, but no dice yet. Anybody have any idea on whats going on here, or a possible fix?
ash
Comment #20
ashtronaut commentedI finally figured out my problem. . . . . .
http://drupal.org/node/230877#comment-774468
ash
Comment #21
wayland76 commentedsubscribe
Comment #22
wayland76 commentedHi all. The attached patch takes Juergen's patch above, and does the following:
1. Remove the site-specific stuff (mentioned in the above posts)
2. Changes the database alterations so they work with a new install as well as upgrade
3. Attempts to implement things for Postgres as well (but unfortunately I don't have a postgres setup to test with)
4. Makes the changes recommended by the Coder module, except one SQL thing that the Coder module was complaining about. The Coder module does automatic review of the code for conformance to the Drupal Coding Standards
Hope this is more applicable than the last patch. The patch is against the latest version of the DRUPAL-5 branch.
@Darren: is there anything else that you want to see in this patch before you apply it (other than testing)?
Comment #23
wayland76 commented(Forgot to set status -- code needs review as per #22).
Comment #24
Freso commentedI'm not sure it's a good idea to have the SQL in a function. What happens when you have to update the table structure? Sure, you'll have to update the SQL used in
xmlsitemap_install()- but you also don't want to change the SQL ofxmlsitemap_update_1()!Also, since you've made the query for pgsql as well, why are you only calling the function when
dbtypeis mysql/i?Comment #25
Freso commentedThe previous patch also didn't apply cleanly to latest DRUPAL-5 branch code. Re-rolled with corrections for .install mentioned above, as well as various style corrections (capitalisations and single quotes instead of double ones) and adding
t()to some introduced Watchdog calls.Comment #26
Freso commentedOh, and for the record: I haven't actually tested the above.
Comment #27
Freso commentedHm. I just spotted a curiosity: Why is
_xmlsitemap_xml_links()in xmlsitemap.module making areturn $linksalready on its second line now? Won't that effectively stop the rest of the code from running? If so, either the rest of the code should be removed (cruft) or the unintentional behaviour should be fixed.I also noticed I missed uppercasing a "true" in
_xmlsitemap_array_slice()...Comment #28
Freso commentedStyle (capitalisation) corrections and a break. Question about
return $linksfrom previous comment still stands unanswered.Comment #29
wayland76 commentedWell, I'm afraid I don't know the answer to that question; that code was added by juergen. If I get time, I'll have a look at it.
Comment #30
wayland76 commentedOk, I've had a look, and gotten rid of that function altogether, and things still seem to work. But it should still be reviewed :).
Comment #31
darren ohFixed in CVS commit 116912. This approach requires modules that implement hook_xmlsitemap_links() to be updated, so the fix will only be applied to the 2.x branch.
Comment #32
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #33
tracy_pilcher commentedHi,
Make sure you run cron before you try accessing the sitemap.xml file for the first time.
That fixed this problem for me.
Comment #34
ansari.wajid commentedHi,
I am getting below errors on different browsers when navigating to the sitemap file: http://chiprv.org/sitemap.xml. Please let me know what might be the problem. Thanks
Error details on Fire Fox:
==================
XML Parsing Error: not well-formed
Location: http://chiprv.org/sitemap.xml
Line Number 58, Column 9:
<ul ="links primary-links"><li class="menu-166 first"><a href="/about-us" title="About Us">About Us</a></li>
--------^
Error details for IE:
===============
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
System error: -2146697204. Error processing resource 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'.
Comment #35
jurgenhaasThe part
<ul ="links primary-links">should be<ul class="links primary-links">, so the attribute-name class is missing in the XML-code. But I'm not sure who is getting this wrong here. Is the sitemap.xml file created by the XMLsitemap module in your case?Comment #36
avpaderno@ansari.wajid: You posted the same comment in three different issues; please stop cross posting, and adding the comment to reports that have nothing to do with your issue.
As I already reported, that is not the output of XML sitemap. Are you sure you are not using Sitemap?
Comment #37
avpadernoI am restoring the report metadata as they were before.
Comment #38
ansari.wajid commentedThanks for your reply.
I am using xmlsitemap module to generate sitemap.xml file. I have 2 domains pointing to my site chipr.org and chiprv.dev.triocircle.com. I have enabled xmlsitemap module through chiprv.org. The sitemap is generated on chiprv.dev.triocircle.com/sitemap.xml, but giving error on chiprv.org/sitemap.xml. I unable to figure out what might be going wrong. Please help me resolve this issue.
thanks
Comment #39
avpadernoWhich version?
Comment #40
dave reid@ansari.wajid: Please open a new issue instead of continuing a closed issue.