-
Notifications
You must be signed in to change notification settings - Fork 440
Open
Description
Describe the bug
In case compile_commands.json contains entries with the same file field value, analyzers may write to the same output plist file and provide corrupted or overwritten results for the entries.
CodeChecker version
6.25.1
To Reproduce
Steps to reproduce the behaviour:
- Prepare openssl v3.3.1 sources
- Prepare compilation database:
mkdir /w/openssl-3.3.1/bld && cd /w/openssl-3.3.1/bld
../Configure --debug && bear -- make -rj$(cat /proc/cpuinfo|grep -c processor)
- Run CodeChecker:
CodeChecker analyze --analyzers clangsa ... ./compile_commands.json -o ./result_clangsa/
- See errors during checking like:
Traceback (most recent call last):
File "/root/.local/share/pipx/venvs/codechecker/lib/python3.12/site-packages/codechecker_analyzer/analysis_manager.py", line 560, in check
source_analyzer.post_analyze(rh)
File "/root/.local/share/pipx/venvs/codechecker/lib/python3.12/site-packages/codechecker_analyzer/analyzers/clangsa/analyzer.py", line 342, in post_analyze
plist = plistlib.load(f)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/plistlib.py", line 884, in load
return p.parse(fp)
^^^^^^^^^^^
File "/usr/lib/python3.12/plistlib.py", line 186, in parse
self.parser.ParseFile(fileobj)
xml.parsers.expat.ExpatError: unclosed token: line 14630, column 17
...
xml.parsers.expat.ExpatError: no element found: line 11968, column 34
...
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 26, column 0
...
xml.parsers.expat.ExpatError: mismatched tag: line 448, column 4
- Check that
compile_commands.jsoncontain two entries for source file/w/openssl-3.3.1/apps/ca.cwith different output file names. - Check that some of the plist files in
./result_clangsa/are damaged due to concurrent writes from several instances of the analyzer. - Single threaded checking via
CodeChecker analyze -j 1 ...will finish successfully, demonstrating concurrency issue.
Expected behaviour
Compilation database entries with the same source file name should be checked separately and write results to different output plist files.
Desktop (please complete the following information)
- CPU: Intel Core i7-13700, 24 threads
- OS: Linux, Ubuntu 24.04 LTS
- Python 3.12
- CodeChecker 6.25.1
Metadata
Metadata
Assignees
Labels
No labels