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

Line count, exceeded timeout: #372

Closed
dluminello opened this issue Feb 22, 2019 · 7 comments
Closed

Line count, exceeded timeout: #372

dluminello opened this issue Feb 22, 2019 · 7 comments

Comments

@dluminello
Copy link

Hello,

I am scanning several of our git repositories with cloc and it seems that I get this particular error on common files among the repositories. Some (most) of them are from open source libraries.
Below are the ones that show up in all the scans that utilize them.

swagger-ui.min.js
angular.min.js
jspdf.min.js
d3.js

@AlDanial
Copy link
Owner

If you're working with the Perl source version (as opposed to the Windows exe), you can make a tweak to try to get around this. Search for this code block

        # Unusual inputs, namely /* within strings without
        # a corresponding */ can cause huge delays so put a timer on this.
        my $max_duration_sec = scalar(@lines)/1000.0; # est lines per second
           $max_duration_sec = 1.0 if $max_duration_sec < 1;
#print "max_duration_sec=$max_duration_sec\n";
        eval {
            local $SIG{ALRM} = sub { die "alarm\n" };
            alarm $max_duration_sec;
            no strict 'refs';
            @lines = &{$subroutine}(\@lines, @args);   # apply filter...
            alarm 0;
        };

then change the line

$max_duration_sec = 1.0 if $max_duration_sec < 1;

to have a value much larger than 1.0. This is the number of seconds to allow the parser to do its thing. However, you may not be pleased with the result as this is in a code branch where the parser is already confused and may take a long time with little to show for its efforts. These minified JavaScript files really mess up cloc's line-centric parsing model.

@dluminello
Copy link
Author

Thanks you for the reply. As of right now we are using the Windows exe version and not the Pearl source version. For now at least I understand what the problem is and not counting a couple hundred (if that) lines of code in those files is not a huge issue.

@asadcr
Copy link
Contributor

asadcr commented Jul 22, 2019

@AlDanial I have similiar issue, CLOC is flaky, sometimes there is exceeded Timeout, sometimes it doesn't. Could it be possible to provide a switch for this. similar to --diff-timeout

@wrljet
Copy link

wrljet commented Jul 22, 2019

I get the timeout, too, Windows 7 with a SSD.
On assembler source files, large-ish ones.

@duaneking
Copy link

How do I fix this? The issue says closed, but I have this exact issue on the newest binary.

@duaneking
Copy link

Using the --timeout param doesn't seem to be well documented.

The help makes it seem like it's completely different and it doesn't create the output that makes it seem like it's going to be a problem for people trying to do things such as run CLOC on the chromium code base.

It needs dramatically updated, and is a critical doc bug. When I scanned the help parameters before running everything I should have been able to easily see that this was going to be a problem for me, And I'm on ssd's so this shouldn't be a problem for me anyway so I cant help but feel like a timeout that by default is not even documented is just bad design.

@duaneking
Copy link

#867

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

No branches or pull requests

5 participants