terryyin / lizard

A simple code complexity analyser without caring about the C/C++ header files or Java imports, supports most of the popular languages.
Other
1.85k stars 250 forks source link

lizard hangs on Ruby code when using multiple threads #284

Open szubersk opened 4 years ago

szubersk commented 4 years ago

$ lizard --version 1.17.3 $ git clone --branch master --quiet https://github.com/DaveGamble/cJSON.git $ lizard -t 4 cJSON/

NLOC CCN token PARAM length location

  36      6    196      2      46 main@9-54@cJSON/fuzzing/fuzz_main.c
   5      1     25      1       5 __init__@14-18@cJSON/tests/unity/auto/unity_test_summary.py
  38      8    310      1      47 run@20-66@cJSON/tests/unity/auto/unity_test_summary.py
   2      1     12      2       2 set_targets@68-69@cJSON/tests/unity/auto/unity_test_summary.py
   2      1     12      2       2 set_root_path@71-72@cJSON/tests/unity/auto/unity_test_summary.py
  10      2     46      2      10 usage@74-83@cJSON/tests/unity/auto/unity_test_summary.py
  22      8    152      3      22 get_details@85-106@cJSON/tests/unity/auto/unity_test_summary.py
   5      2     59      2       6 parse_test_summary@108-113@cJSON/tests/unity/auto/unity_test_summary.py
  44      8    202      1      55 read_file@29-83@cJSON/fuzzing/afl.c
  78     19    339      2      92 main@85-176@cJSON/fuzzing/afl.c
  46     21    333      2      60 LLVMFuzzerTestOneInput@13-72@cJSON/fuzzing/cjson_read_fuzzer.c
   8      1     42      1       8 __init__@10-17@cJSON/tests/unity/auto/unity_to_junit.py
  64     15    615      1      84 run@19-102@cJSON/tests/unity/auto/unity_to_junit.py
   2      1     12      2       2 set_targets@104-105@cJSON/tests/unity/auto/unity_to_junit.py
   2      1     12      2       2 set_root_path@107-108@cJSON/tests/unity/auto/unity_to_junit.py
  10      2     44      1      10 usage@111-120@cJSON/tests/unity/auto/unity_to_junit.py

Exception in thread Thread-3: Traceback (most recent call last): File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/lib64/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/usr/lib64/python3.6/multiprocessing/pool.py", line 463, in _handle_results task = get() File "/usr/lib64/python3.6/multiprocessing/connection.py", line 251, in recv return _ForkingPickler.loads(buf.getbuffer()) File "/usr/local/lib/python3.6/site-packages/lizard_languages/ruby.py", line 12, in new return super(MyToken, cls).new(cls, value.group(0)) AttributeError: 'str' object has no attribute 'group'

hungs indefinitely

...

$ lizard cJSON

NLOC CCN token PARAM length location

  36      6    196      2      46 main@9-54@cJSON/fuzzing/fuzz_main.c

works ok

terryyin commented 4 years ago

Will take a look asap.

On 28 Apr 2020, at 8:00 PM, Damian Szuberski notifications@github.com wrote:

$ lizard --version 1.17.3 $ git clone --branch master --quiet https://github.com/DaveGamble/cJSON.git https://github.com/DaveGamble/cJSON.git $ lizard -t 4 cJSON/

NLOC CCN token PARAM length location

36 6 196 2 46 main@9-54@cJSON/fuzzing/fuzz_main.c 5 1 25 1 5 init@14-18@cJSON/tests/unity/auto/unity_test_summary.py 38 8 310 1 47 run@20-66@cJSON/tests/unity/auto/unity_test_summary.py 2 1 12 2 2 set_targets@68-69@cJSON/tests/unity/auto/unity_test_summary.py 2 1 12 2 2 set_root_path@71-72@cJSON/tests/unity/auto/unity_test_summary.py 10 2 46 2 10 usage@74-83@cJSON/tests/unity/auto/unity_test_summary.py 22 8 152 3 22 get_details@85-106@cJSON/tests/unity/auto/unity_test_summary.py 5 2 59 2 6 parse_test_summary@108-113@cJSON/tests/unity/auto/unity_test_summary.py 44 8 202 1 55 read_file@29-83@cJSON/fuzzing/afl.c 78 19 339 2 92 main@85-176@cJSON/fuzzing/afl.c 46 21 333 2 60 LLVMFuzzerTestOneInput@13-72@cJSON/fuzzing/cjson_read_fuzzer.c 8 1 42 1 8 init@10-17@cJSON/tests/unity/auto/unity_to_junit.py 64 15 615 1 84 run@19-102@cJSON/tests/unity/auto/unity_to_junit.py 2 1 12 2 2 set_targets@104-105@cJSON/tests/unity/auto/unity_to_junit.py 2 1 12 2 2 set_root_path@107-108@cJSON/tests/unity/auto/unity_to_junit.py 10 2 44 1 10 usage@111-120@cJSON/tests/unity/auto/unity_to_junit.py Exception in thread Thread-3: Traceback (most recent call last): File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/lib64/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/usr/lib64/python3.6/multiprocessing/pool.py", line 463, in _handle_results task = get() File "/usr/lib64/python3.6/multiprocessing/connection.py", line 251, in recv return _ForkingPickler.loads(buf.getbuffer()) File "/usr/local/lib/python3.6/site-packages/lizard_languages/ruby.py", line 12, in new return super(MyToken, cls).new(cls, value.group(0)) AttributeError: 'str' object has no attribute 'group'

hungs indefinitely

...

$ lizard cJSON

NLOC CCN token PARAM length location

36 6 196 2 46 main@9-54@cJSON/fuzzing/fuzz_main.c works ok

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/terryyin/lizard/issues/284, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGASYXS4F7HFIILQSASO63RO3AN7ANCNFSM4MSYN2YA.

terryyin commented 4 years ago

Yes, now I recall that Ruby parser has trouble with multiple thread. Ruby claims to be a language that makes the developers happy, I guess which in turn makes the parsing harder.

Let me see if I can fix this...

farrrb commented 3 years ago

Having very similar trouble with C language. Sometimes the program on the build server just hang. Reducing the worker thread count to 1 seems to eliminate the problem.