facebook / infer

A static analyzer for Java, C, C++, and Objective-C
http://fbinfer.com/
MIT License
14.8k stars 2k forks source link

Unable to assign multiple jobs when running infer inside docker #1763

Open phnx opened 1 year ago

phnx commented 1 year ago

I'm using infer in a customized docker container (Ubuntu 20.04). Infer was installed from the latest release.

$ infer --version
Infer version v1.1.0
Copyright 2009 - present Facebook. All Rights Reserved.

The capture command below works fine.

 infer capture -- make

However, when I start the analysis without specifying the job number. I receive following errors.

$ infer analyze        
Found 34 source files to analyze in /path/to/source/infer-out
Uncaught Internal Error: (Unix.Unix_error "No child processes" waitpid "((mode (WNOHANG)) (pid -1))")
Error backtrace:
Raised at Core__Core_unix.improve in file "src/core_unix.ml" (inlined), line 46, characters 4-43
Called from Core__Core_unix.wait_gen in file "src/core_unix.ml" (inlined), line 942, characters 4-246
Called from Core__Core_unix.wait_nohang in file "src/core_unix.ml" (inlined), line 979, characters 2-46
Called from IBase__ProcessPool.has_dead_child in file "src/base/ProcessPool.ml", line 194, characters 2-23
Called from Backend__InferAnalyze.analyze in file "src/backend/InferAnalyze.ml", line 200, characters 24-47
Called from Integration__Driver.execute_analyze.(fun) in file "src/integration/Driver.ml" (inlined), line 170, characters 2-34
Called from Backend__GCStats.log_f in file "src/backend/GCStats.ml" (inlined), line 90, characters 10-14
Called from Integration__Driver.execute_analyze in file "src/integration/Driver.ml", line 167, characters 2-239
Called from IBase__Utils.timeit in file "src/base/Utils.ml", line 429, characters 16-20
Called from IBase__ScubaLogging.execute_with_time_logging in file "src/base/ScubaLogging.ml" (inlined), line 79, characters 29-44
Called from Integration__Driver.analyze_and_report in file "src/integration/Driver.ml" (inlined), line 281, characters 2-144
Called from Dune__exe__Infer.run in file "src/infer.ml" (inlined), line 21, characters 2-47
Called from IBase__Utils.timeit in file "src/base/Utils.ml" (inlined), line 429, characters 16-20
Called from IBase__ScubaLogging.execute_with_time_logging in file "src/base/ScubaLogging.ml" (inlined), line 79, characters 29-44
Called from Dune__exe__Infer.run in file "src/infer.ml", line 25, characters 22-94

The only workaround is to explicitly specify #job = 1, which will take longer time to run.

$ infer analyze -j 1

I think this has something to do with the number of available CPU cores inside docker. But I couldn't find that information in the document. Appreciate all suggestions.