Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /sites/all/modules/twitter/twitter.inc:477
| Project: | |
| Version: | 6.x-2.6 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
xxxx replace private information:
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/xxxxx/public_html/sites/all/modules/twitter/twitter.inc:477
Stack trace:
#0 /home/xxxxxxx/public_html/sites/all/modules/twitter/twitter.inc(477): SimpleXMLElement->__construct('')
#1 /home/xxxxxx/public_html/sites/all/modules/twitter/twitter.inc(101): _twitter_convert_xml_to_array(NULL)
#2 /home/xxxxxxx/public_html/sites/all/modules/twitter/twitter.module(185): twitter_fetch_timeline('xxxxxxxxxxxxx')
#3 [internal function]: twitter_cron()
#4 /home/xxxxxxx/public_html/includes/module.inc(471): call_user_func_array('twitter_cron', Array)
#5 /home/xxxxxxx/public_html/includes/common.inc(2661): module_invoke_all('cron')
#6 /home/xxxxxxxx/public_html/cron.php(11): drupal_cron_run()
#7 {main}
thrown in /home/xxxxxxx/public_html/sites/all/modules/twitter/twitter.inc on line 477

#1
Possibly related to #475924: Uncaught exception at SimpleXMLElement constructor
#2
This is an issue with the twitter service rather than the Drupal twitter module as such.
I have been getting this error intermittently for ages, and every so often tried to work out what is causing it but not been able to pin it down. Was it a dodgy XML character, a problem with the parser, or twitter doing something strange? The error was intermittent and I couldn't replicate it.
However, there was a Denial of service attack on Twitter this afternoon which wiped out the whole service. Presto - Three of my cron runs threw up this error whilst the servers were down. Suddenly I could generate this error with every cron run. Now it is working correctly again.
It seems pretty clear then that this is caused by Twitter's server failing rather than any fault in the module. It should be safe to ignore this error in future.
I'm going to mark this as closed to avoid cluttering up the issue queue.
#3
Got the error right now, one day after the twitter ddos problems...
#4
Same here, but as mentioned before this seems to be a Twitter problem.
Will wait a few hours/days and see.
#5
This has been happening to me too. I "fixed" the problem by wrapping the contents of twitter_cron inside a try/catch clause. Patch attached.
It's basically just:
function twitter_cron() {try {
// contents
}
catch (Exception $e) {
watchdog('twitter', 'Cron failed.');
}
}
I also recommend setting a high weight value for the twitter module in the system table so it runs last during cron. I set mine to a weight of 20.
#6
srhaber, Patch seems clean and works as expected. Screenshot of watchdog log entry attached.
Prbass, even though the source of the error is twitter.com, the error is frequent, and twitter module can not assume that twitter.com is working. It needs to handle this error better, because other unrelated cron events are not getting executed when twitter is down. srhaber's patch implements the best solution possible, IMHO.
#7
#8
Subscribing, because of same problem here (now testing the try-catch-patch).
#9
Tested the patch and it works. Connection errors doesn't catch the users eyes anymore.
Would love to see this fixed but there is no stronger status than RTBC.
Maybe "Really reviewed & tested by the community and really ready to be committed" :-)
#10
same problem here! applied the patch and fixed.
I think this is critical since it prevents cron from running. it should be handled properly.
Marking it critical again.
Thanks
#11
subscribing.
#12
Will this patch be included to the next Twitter module version???
#13
Same problem, waiting for a fixed release.