Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infinite loop at AddInTree #246

Closed
nobod33 opened this issue Jan 23, 2024 · 4 comments · Fixed by #247
Closed

infinite loop at AddInTree #246

nobod33 opened this issue Jan 23, 2024 · 4 comments · Fixed by #247

Comments

@nobod33
Copy link

nobod33 commented Jan 23, 2024

Describe the bug

On one particular dataset getting into semi random infinite loops add AddInTree:

        # Val is a new one higher
        if ($Debug) {
                debug( "  keytoadd val=$keyval is higher than lowerval=$lowerval", 4 );
        }
        $val{$keyval} = $keytoadd;
        my $valcursor = $lowerval;    # valcursor is value just before keyval
        while ( $nextval{$valcursor} && ( $nextval{$valcursor} < $keyval ) ) {
                if($valcursor == $nextval{$valcursor}) {
                        print "loop\n";
                }
                $valcursor = $nextval{$valcursor};
        }

It's not constant. Sometimes finishes, more often than not - no. Original host where it was first observed - Cloudlinux 8(Awstats - 7.9 (build 20230108)/perl v5.26.3), for testing purposes copied dataset to Debian 11(Awstats - 7.9 (build 20230108)/perl v5.32.1) machine, where it shows similar/same behaviour. Following ofc. Is not from original code:

                if($valcursor == $nextval{$valcursor}) {
                        print "loop\n";
                }

seen no specific pattern on where it hangs(XXXX.YYY ann some-pathY are changed):

Tue Jan 23 14:13:41 2024 - DEBUG 4 - &nbsp;&nbsp;  Add in tree entry 100 : //XXXX.YYY/some-pathX/ (value=9, tree not full)<br />
Tue Jan 23 14:13:41 2024 - DEBUG 4 - &nbsp;&nbsp;  keytoadd val=9 is higher than lowerval=1<br />
Tue Jan 23 14:14:32 2024 - DEBUG 4 - &nbsp;&nbsp;  Add in tree entry 40 : //XXXX.YYY/some-pathY/ (value=76, tree not full)<br />
Tue Jan 23 14:14:32 2024 - DEBUG 4 - &nbsp;&nbsp;  keytoadd val=76 is higher than lowerval=1<br />

To Reproduce
Steps to reproduce the behavior are likely data dependent. Otherwise following has been executed.

/usr/bin/perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=XXXX.YYY -staticlinks=awstats.XXXX.YYY.2401 -diricons=icon -configdir=/home/USERNAME/domains/XXXX.YYY/awstats/.data -output=keywords
@manuelm
Copy link
Contributor

manuelm commented Feb 21, 2024

We've noticed the same issue. I've managed to trigger the behavior with the following few lines

$lowerval = 0;
%val      = ();
%nextval  = ();
%egal     = ();
AddInTree("0", 30, 0);
AddInTree("--", 30);
AddInTree("testing", 237);

@akansc
Copy link

akansc commented Mar 25, 2024

We're facing exactly the same issue with infinitive loop in

while ( $nextval{$valcursor} && ( $nextval{$valcursor} < $keyval ) ) {

Any news on when it could possibly be pached?

@manuelm
Copy link
Contributor

manuelm commented Mar 25, 2024

Any news on when it could possibly be pached?

See #247

@akansc
Copy link

akansc commented Mar 25, 2024

Yes, but this was not merged yet. We did apply to the one particular system that currently fails nasty with the bug, but we're reluctant on mass applying the patch without an official release.

@eldy eldy closed this as completed in #247 May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants