Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If we run multiple CodeChecker commands (login, store) which uses the same home directory and the CodeChecker session file (`~/.codechecker.session.json`) does not exist yet the following scenario is possible: - The first command recognizes that this file doesn't exist yet so it will open this file for writing. - Before the first command writes data to the file the second command will be run. It recognizes that the file exists, so it will read up the file. It expects that the file is a valid json file but it is empty. So the `token_dict` variable will be an empty dict, we try to get the `tokens` member of this empty dictionary (`self.__tokens`) which will be `None`, and when we will try to iterate over this directory (which is `None` in our case) the CodeChecker will raise an exception. To solve this problem we will use `portalocker` after we opened the file to lock it, so only one process will be able to read/write this file simultaneously. Also we will handle the use case when this file is still empty.
- Loading branch information