Versions
- SonarQube Server 2026.1.3.123084 (self-hosted)
- SonarScanner CLI 8.1.0.6389, Java 21.0.9 (Eclipse Adoptium, provisioned by the server)
- CFamily plugin 6.77.0.95488
- Windows 11 x64 build agents, 32 logical CPUs, 31 GB RAM + 32 GB pagefile
- Compiler: MSVC 19.42 (14.42.34433),
Hostx64\x86\cl.exe,/std:c++latest(CFamily reportsDetected standards: c++23=4268;c11=1) - Analysis mode: Compile-Commands (
sonar.cfamily.compile-commands), default thread count (32), pull request analysis
What we are trying to achieve
Pull request analysis of a ~4,300-translation-unit C++ project. Analysis of master works normally (about 10 s per translation unit). The pull request never finishes.
What happens
- The CFamily sensor starts normally. The first ~400 translation units take 5–27 s each.
- Starting about 30 s into the C++ analysis, workers pick up certain files and never finish them. Within about 3 minutes, all 32 workers are stuck.
- We measured the stuck
subprocess.exeworkers on the agent:- Each one sits at 100% of one core for the whole time it is stuck. We watched for 4–6 minutes, and one earlier run was stuck for more than 20 minutes.
- Memory per worker jumps to about 1.2–1.4 GB within a few seconds and then barely grows (about 7 MB in 2 minutes).
- No progress lines are logged in the meantime.
- After about 20 minutes the scan fails:
ERROR [stderr] LLVM ERROR: out of memory
ERROR [stderr] Allocation failed
(repeated 5x)
INFO Reached stage: parsing
INFO Requesting reproducer for: ...\Src\AreaMonitor\CAreaMonitoringEngine.cpp
The same code compiles without problems with MSVC.
What the pull request changes
In the serialization helpers, the list of serializable members changes from a std::tuple of member pointers (a value) to member pointers used as non-type template arguments. Hundreds of classes, included by most translation units, now look like this:
template <auto... MemberPointers>
struct Fields
{
// Fields<&A::a>::Add<&A::b> is Fields<&A::a, &A::b>, for macros that list one member at a time
template <auto MemberPointer>
using Add = Fields<MemberPointers..., MemberPointer>;
};
template <typename Function, auto... MemberPointers>
constexpr decltype( auto ) ApplyFields( Function&& function, Fields<MemberPointers...> )
{
return std::forward<Function>( function )( MemberPointers... );
}
template <auto... MemberPointers>
struct std::tuple_size<Fields<MemberPointers...>>
: std::integral_constant<std::size_t, sizeof...( MemberPointers )> {};
// Serializable classes, written by hand:
struct CTrip
{
static constexpr auto GetFields()
{
return Fields<&CTrip::m_blockIndex, &CTrip::m_blockNumber, /* ~30 members */>{};
}
// ...
};
// ...or generated by a macro, one member at a time:
// return Fields<>::Add<&T::m_a>::Add<&T::m_b>::Add<&T::m_c>{};
// Used for (de)serialization:
template <typename T>
Archive& Serialize( const T& value, decltype( GetFields( T{} ) ) fields = GetFields( T{} ) )
{
auto fun = [&]( auto... structFields ) { ( ::operator<<( *this, value.*structFields ), ... ); };
ApplyFields( fun, fields );
return *this;
}
Before the change, GetFields() returned std::tuple{ &A::a, &A::b, ... } and ApplyFields used std::apply. That version analyses fine.
What we have checked
master(withstd::tuple) analyses normally on the same agents, with the same scanner and server.- The hang is not caused by resource limits. Workers are CPU-bound, memory stays flat, and the agent was not paging while the workers were stuck. Running out of memory only happens after a long time.
- We have not yet narrowed down whether the
Addalias chain or the member-pointer template parameters themselves trigger it. We plan to scan a single affected file (sonar.inclusions) with each variant and will post the result here.
What we can provide
- The scanner requested a reproducer for
CAreaMonitoringEngine.cpp. We can share it privately, since it contains proprietary source. - Debug logs (
sonar.verbose=true) of a single-file run, if helpful.
Is this a known issue in CFamily 6.77? Is there a per-file time limit or an analysis option we can use to stop a single translation unit from blocking the whole scan in the meantime?