2010-10-13 Sancho Lerena <slerena@artica.es>
* Core.pm: Force XML::Simple to use XML::Parser instead SAX to manage XML due a bug processing some XML with blank spaces. * DataServer.pm: Checking for BADXML is 2 times with 2 secs of delay now. Aditional check before deleting / procesing XML. * pandora_server: Added handle of BadXML error to avoid see "unhandled" errors on log, and set to verbose level 2. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3388 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
6aaf6155c0
commit
d044abe8f7
|
@ -1,3 +1,14 @@
|
||||||
|
2010-10-13 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
|
* Core.pm: Force XML::Simple to use XML::Parser instead SAX to manage XML
|
||||||
|
due a bug processing some XML with blank spaces.
|
||||||
|
|
||||||
|
* DataServer.pm: Checking for BADXML is 2 times with 2 secs of delay now.
|
||||||
|
Aditional check before deleting / procesing XML.
|
||||||
|
|
||||||
|
* pandora_server: Added handle of BadXML error to avoid see "unhandled"
|
||||||
|
errors on log, and set to verbose level 2.
|
||||||
|
|
||||||
2010-10-07 Sancho Lerena <slerena@artica.es>
|
2010-10-07 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
* conf/pandora_server.conf: Removed multicast options
|
* conf/pandora_server.conf: Removed multicast options
|
||||||
|
|
|
@ -134,9 +134,19 @@ sub pandora_crash () {
|
||||||
# will be nice to replace this code, but at this time it's the only way I know
|
# will be nice to replace this code, but at this time it's the only way I know
|
||||||
|
|
||||||
foreach my $error_line (@_) {
|
foreach my $error_line (@_) {
|
||||||
if ($error_line !~ m/Enterprise/i && $error_line !~ m/Format_XS/i && $error_line !~ m/ConfigLocal/i){
|
|
||||||
|
# Trap the XML error and exit without nasty messages
|
||||||
|
if ($error_line =~ m/XML\/Parser/){
|
||||||
|
logger (\%Config, "Problem parsing XML file, XML file discarded: $error_line", 2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
elsif ($error_line !~ m/Enterprise/i && $error_line !~ m/Format_XS/i && $error_line !~ m/ConfigLocal/i){
|
||||||
logger (\%Config, '[E] \'' . $Config{'servername'} . "': $error_line", 1);
|
logger (\%Config, '[E] \'' . $Config{'servername'} . "': $error_line", 1);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
|
||||||
|
else {
|
||||||
if ($error_line !~ m/Can\'t\slocate/) {
|
if ($error_line !~ m/Can\'t\slocate/) {
|
||||||
logger (\%Config, '[E] \'' . $Config{'servername'} . "': $error_line", 1);
|
logger (\%Config, '[E] \'' . $Config{'servername'} . "': $error_line", 1);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -109,6 +109,12 @@ use HTML::Entities;
|
||||||
use Time::Local;
|
use Time::Local;
|
||||||
use POSIX qw(strftime);
|
use POSIX qw(strftime);
|
||||||
|
|
||||||
|
# Force XML::Simple to use XML::Parser instead SAX to manage XML
|
||||||
|
# due a bug processing some XML with blank spaces.
|
||||||
|
# See http://www.perlmonks.org/?node_id=706838
|
||||||
|
|
||||||
|
$XML::Simple::PREFERRED_PARSER='XML::Parser';
|
||||||
|
|
||||||
# Default lib dir for RPM and DEB packages
|
# Default lib dir for RPM and DEB packages
|
||||||
use lib '/usr/lib/perl5';
|
use lib '/usr/lib/perl5';
|
||||||
|
|
||||||
|
|
|
@ -145,10 +145,10 @@ sub data_consumer ($$) {
|
||||||
# Double check that the file exists
|
# Double check that the file exists
|
||||||
return unless (-f $file_name);
|
return unless (-f $file_name);
|
||||||
|
|
||||||
# Try to parse the XML 3 times
|
# Try to parse the XML 2 times, with a delay between tries of 2 seconds
|
||||||
my $xml_data;
|
my $xml_data;
|
||||||
|
|
||||||
for (1..3) {
|
for (0..1) {
|
||||||
eval {
|
eval {
|
||||||
threads->yield;
|
threads->yield;
|
||||||
$xml_data = XMLin ($file_name, forcearray => 'module');
|
$xml_data = XMLin ($file_name, forcearray => 'module');
|
||||||
|
@ -157,13 +157,16 @@ sub data_consumer ($$) {
|
||||||
# Invalid XML
|
# Invalid XML
|
||||||
if ($@) {
|
if ($@) {
|
||||||
$xml_err = $@;
|
$xml_err = $@;
|
||||||
sleep (1);
|
sleep (2);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ignore the timestamp in the XML and use the file timestamp instead
|
# Ignore the timestamp in the XML and use the file timestamp instead
|
||||||
$xml_data->{'timestamp'} = strftime ("%Y-%m-%d %H:%M:%S", localtime((stat($file_name))[9])) if ($pa_config->{'use_xml_timestamp'} eq '1' || ! defined ($xml_data->{'timestamp'}));
|
$xml_data->{'timestamp'} = strftime ("%Y-%m-%d %H:%M:%S", localtime((stat($file_name))[9])) if ($pa_config->{'use_xml_timestamp'} eq '1' || ! defined ($xml_data->{'timestamp'}));
|
||||||
|
|
||||||
|
# Double check that the file exists
|
||||||
|
return unless (-f $file_name);
|
||||||
|
|
||||||
unlink ($file_name);
|
unlink ($file_name);
|
||||||
process_xml_data ($self->getConfig (), $file_name, $xml_data, $self->getServerID (), $self->getDBH ());
|
process_xml_data ($self->getConfig (), $file_name, $xml_data, $self->getServerID (), $self->getDBH ());
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue