eldy / AWStats

AWStats Log Analyzer project (official sources)
https://www.awstats.org
361 stars 119 forks source link

If search keyword with value 0 exists, awstats freezes #250

Open hzahradnik opened 2 weeks ago

hzahradnik commented 2 weeks ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Use default settings for IIS log files
  2. Use this log file: demo.log
  3. awstats.pl -config=demo -update -LogFile="demo.log"
  4. Program freezes. This happens not every time, due to a random insert order.

Expected behavior Program finishes and statistic is updated.

Screenshots Not applicable.

Desktop (please complete the following information):

Additional context I already analyzed the problem and fixed it for me. The error happens, because awstats detects a search keyword with the value 0. If another keyword has the same number of instances, the check for existance of this key in AddInTree fails and the value is inserted. After that, the nextval hash has an entry with the same value for key and value. If a subsequent insert tries to find the correct position, we are stuck in an infinite loop.

My fix on line 8369 is just using exists for the check, if a key exists.

if ( exists $val{$keyval} ) {    # Val is already in tree
ShaiMagal commented 1 week ago

@hzahradnik

Hi, why you didn't make PR for this fix?

EDIT: I think, it's already fixed by this PR: https://github.com/eldy/AWStats/pull/247/files

So this (#250) can be closed.