darold / squidanalyzer

Squid Analyzer parses Squid proxy access log and reports general statistics about hits, bytes, users, networks, top URLs, and top second level domains. Statistic reports are oriented toward user and bandwidth control.
http://squidanalyzer.darold.net/
125 stars 36 forks source link

SquidAnalyzer crashes because of UseClientDNSName directive #192

Closed blakkheimgw closed 5 years ago

blakkheimgw commented 5 years ago

Hello,

Since a few weeks, squidanalyzer isn't generating new reports anymore. So I updated it to the latest master branch and did a fresh install. But the process keeps crashing when I launch it :

squid-analyzer -d
SquidAnalyzer version 6.6
Starting to parse logfile /log/squid/access.log.
DEBUG: this file will be parsed, no history found.
Reading file /log/squid/access.log from offset 0 to end.
SQUID LOG SET START TIME: Sun Nov  4 03:15:27 2018
_gethostbyaddr timeout reach for ip: 172.31.75.23, timeout can be adjusted with directive DNSLookupTimeout
Alarm clock

The IP adress showed on the debug log is actually resolvable by the DNS server the OS is using. Disabling the DNS lookup works but I would like to keep this functionnality. I've tried to increase the DNSLookupTimeout to a geater value, without success.

Any ideas ?

Thank you.

darold commented 5 years ago

Hello,

SquidAnalyzer should not crash with "Alarm clock" message, what is your Perl version and operating system?

Regards,

blakkheimgw commented 5 years ago

Hello,

Perl version : 5.10.1 OS version : Red Hat Enterprise Linux Server release 6.10 (Santiago)

Thank you.

Regards.

darold commented 5 years ago

Sorry for the response time, can you execute the following perl commands on your server and post the result:

perl -we 'local $SIG{ALRM} = sub { die "DNS lookup timeout.\n"; }; alarm(1); 1 while 1'
perl -we'alarm(1); 1 while 1'

in my case (perl v5.26.1 / debian sid) I get the following results:

$ perl -we 'local $SIG{ALRM} = sub { die "DNS lookup timeout.\n"; }; alarm(1); 1 while 1'
DNS lookup timeout.
$ perl -we'alarm(1); 1 while 1'
Alarm clock

the first command is what is done in SquidAnalyzer.pm with the gethostbyaddr() call.

On a RH 7 with perl v5.26.1 I have the same result than on my computer.

blakkheimgw commented 5 years ago

Hello,

Here are the results of the commands, the same as yours :

# perl -we 'local $SIG{ALRM} = sub { die "DNS lookup timeout.\n"; }; alarm(1); 1 while 1'
DNS lookup timeout.
# perl -we'alarm(1); 1 while 1'
Alarm clock

Regards.

darold commented 5 years ago

I do not understand and can't reproduce this problem it should works following your last report. I will download a RH6 with Perl 5.10 to see if I can reproduce on this particular distribution.

darold commented 5 years ago

I'm closing this issue because I can not reproduce the problem even on a RH6 like OS:

 [root@localhost ~]# cat /etc/redhat-release 
CentOS release 6.10 (Final)
[root@localhost ~]# perl -v | grep "This is perl"
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
[root@localhost ~]# perl -we 'local $SIG{ALRM} = sub { die "DNS lookup timeout.\n"; }; alarm(1); 1 while 1'
DNS lookup timeout.
[root@localhost ~]# perl -we'alarm(1); 1 while 1'
Alarm clock

I don't know what specific RH6 library on your server can produce this issue. You may want to upgrade your OS or run SquidAnalyzer on an other server.