Ericsson / codechecker

CodeChecker is an analyzer tooling, defect database and viewer extension for the Clang Static Analyzer and Clang Tidy
https://codechecker.readthedocs.io
Apache License 2.0
2.23k stars 375 forks source link

Storage failed: '>' not supported between instances of 'float' and 'NoneType' #2758

Open sylvestre opened 4 years ago

sylvestre commented 4 years ago

Describe the bug codechecker store fails with

[INFO 2020-05-23 13:27] - Storage failed: '>' not supported between instances of 'float' and 'NoneType'

CodeChecker version

CodeChecker analyzer version:
---------------------------------------------------------------
Kind                 | Version                                 
---------------------------------------------------------------
Base package version | 6.13.0                                  
Package build date   | 2020-05-23T10:49                        
Git commit ID (hash) | 2934ac134ce141f7cc91a948cbba8e6389381fac
Git tag information  | 6.13                                    
---------------------------------------------------------------

CodeChecker web version:
------------------------------------------------------------------------
Kind                          | Version                                 
------------------------------------------------------------------------
Base package version          | 6.13.0                                  
Package build date            | 2020-05-23T10:49                        
Git commit ID (hash)          | 2934ac134ce141f7cc91a948cbba8e6389381fac
Git tag information           | 6.13                                    
Server supported API (Thrift) | 6.27                                    
Client API (Thrift)           | 6.27                                    
------------------------------------------------------------------------

To Reproduce

$ CodeChecker store codechecker-results/ -n firefox_$(date "+%Y%m%d%H%M") --url firefox
[INFO 2020-05-23 10:41] - Storing analysis results for run 'firefox_202005231041'
[INFO 2020-05-23 10:41] - Checking local passwords or tokens in /var/lib/jenkins/.codechecker.passwords.json
[INFO 2020-05-23 10:41] - Password file not found.
[INFO 2020-05-23 10:41] - Checking for local valid sessions.
[INFO 2020-05-23 13:27] - Storage failed: '>' not supported between instances of 'float' and 'NoneType'

Happy to help debugging

(it would be nice to show the backtrace)

csordasmarton commented 4 years ago

@sylvestre Could you please run your store command in debug mode (--verbose debug) and send us your output.

sylvestre commented 4 years ago

I did it and it took more than 13h to get this error:

[DEBUG][2020-05-25 07:52:04] {system} [15707] <140713747179328> - store.py:366 assemble_zip() - Copying file '/var/lib/jenkins/workspace/firefox-codechecker/codechecker-results/DecryptJob.cpp_clang-tidy_9ee326367450416a9885397e67a737f1.plist' to ZIP assembly dir...
[INFO][2020-05-25 08:09:14] {system} [15707] <140713747179328> - store.py:646 main() - Storage failed: Can't close the ZIP file while there is an open writing handle on it. Close the writing handle before closing the zip.
Exception ignored in: <function ZipFile.__del__ at 0x7ffa7842fea0>
Traceback (most recent call last):
  File "/usr/lib/python3.7/zipfile.py", line 1789, in __del__
    self.close()
  File "/usr/lib/python3.7/zipfile.py", line 1798, in close
    raise ValueError("Can't close the ZIP file while there is "
ValueError: Can't close the ZIP file while there is an open writing handle on it. Close the writing handle before closing the zip.

which is of course different ... :)

My codechecker-results directory is 257 Go. I am trying to run it again if I get the same error again

gyorb commented 4 years ago

Could the current way of extracting the zip file on the server side cause this problem? It it written out to the disk and immediately read back for extraction.
https://github.com/Ericsson/codechecker/blob/9b25c841942b8992a808bda831f8eee8eab137f1/web/server/codechecker_server/api/report_server.py#L505-L525

Probably the name should be used to open for read:

         with zipfile.ZipFile(zip_file.name, 'r', allowZip64=True) as zipf: 

Based on the documentation on Unix platforms it can be opened a second time again.

Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later).

@sylvestre on which platform do you try run it?

sylvestre commented 4 years ago

I tried again in Debug and yeah, same pb again with zip.

on which platform do you try run it?

@gyorb on Debian

sylvestre commented 4 years ago

@gyorb did something change in "CodeChecker store" recently? It used to be pretty fast. Now, it has been running for more 10 hours (and still running)

gyorb commented 4 years ago

In the latest release v6.12.0 there were some clang-tidy configuration changes to show results from the header files. It can increase the found reports. Are there a lot more reports after that change? You can switch back to the old behavior with this analyzer configuration: CodeChecker analyze compile_command.json --analyzer-config clang-tidy:HeaderFilterRegex=\"\"

Could you try to run an analysis with this configuration?

irishrover commented 4 years ago

I faced with it. Seems codechecker/web/client/codechecker_client/cmd/store.py:324

                if sc_handler.has_source_line_comments(file_path, report_line):
                    file_hash_with_review_status.add(file_hash)

reading every single file takes a long.

gyorb commented 4 years ago

That part was not touched recently but maybe the increased report count causes to check a lot more files than before.

We will need to check what can be improved there.

gyorb commented 4 years ago

I'm working on some performance improvements for the store command.

sylvestre commented 4 years ago

@gyorb sorry it took forever for me to get back to this (as it takes almost a full day to run) Using

CodeChecker analyze compile_command.json --analyzer-config clang-tidy:HeaderFilterRegex=\"\"

indeed made the build completed.

I will try to run store in verbose mode but it takes several days to run :/

gyorb commented 4 years ago

@sylvestre there were some performance improvements done for the store did you have time to try it out?