Skip to content

Infinite hang with CodeChecker on clang without analyser #2670

Open

Description

@whisperity

Describe the bug
If the clang binary used from PATH is built without Clang Static Analyzer, the fetching of checkers hangs infinitely.

CodeChecker version
Irrelevant, but exists with 6.11.

To Reproduce
Steps to reproduce the behaviour:

  1. Build LLVM/Clang without ClangSA: cmake ... -DCLANG_ENABLE_STATIC_ANALYZER=OFF
  2. Put the Build/bin into PATH
  3. Run something from CodeChecker that has to fetch checkers: checkers, analyze.
  4. Wait infinitely.
  5. See error

Expected behaviour
Fetch that there are no ClangSA checkers in the list, but do not hang.

Desktop (please complete the following information)

  • OS: Linux

Additional context
The issue is due to Clang dumping checker list by calling clang++ -cc1 -analyzer-checker-help. If there is a static analyzer, this dumps the checker list and early returns — but if there is no ClangSA built, the call is "equivalent" to calling clang++ -cc1 which will wait for preprocessed text on the standard input.

In case the standard input is not the tty stdin, but a file, e.g. calling: echo "" | clang -cc1 -analyzer-checker-help

  • when there is ClangSA built: same output as usual
  • when there is no ClangSA: output is an empty string, but the binary exits immediately and without side effects seemingly.

The issue might need to be fixed within Clang, in addition, because it is bad behaviour there that it starts waiting for stdin...

Activity

  1. irishrover commented on Apr 4, 2020

    @irishrover
    Contributor

    It's called via subprocess.check_output, so timeout param can be used to fix the hang.

    https://docs.python.org/3/library/subprocess.html#subprocess.check_output

  2. whisperity commented on Apr 7, 2020

    @whisperity
    ContributorAuthor

    Is timeout a good choice? The problem with timeouts is that we can never know what's sensible. If we set it to, let's say, 10 seconds, but the machine the tool is running on is so loaded (or has network-mounted storage?) that loading the checker list (for example if plugins are used) would take 15 seconds, it'll falsely say that there are no checkers.

  3. whisperity commented on May 12, 2020

    @whisperity
    ContributorAuthor

    Another interesting thing: I tried disabling clangsa by specifying --analyzers clang-tidy to the analyze command but it still tries to access the clang binary (for some resource dir printing stuff) and also tries getting the checkers, resulting in this hang.

  4. whisperity commented on Aug 22, 2025

    @whisperity
    ContributorAuthor

    (Bump: I ran into this thing again today. 😬)

  5. SamirRafiei commented on Sep 9, 2026

    @SamirRafiei

    I would like to work on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

analyzer 📈Related to the analyze commands (analysis driver)bug 🐛good to go 🚀Issues that can be assigned for implementationusability 👍Usability-related features

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions