#43469·grpc

C++: public grpcpp headers emit -Wdeprecated-declarations with abseil >= 20260107.0 (absl::MutexLock pointer ctor, IdentityKeyCertPair)

Author: bilalbaCreated Sep 17, 2026Updated Sep 29, 2026
Labelskind/buglang/c++priority/P2untriaged

What operating system (Linux, Windows,...) and version?

Linux x86_64 (kernel 7.0), Chromium sysroot with glibc 2.31.

What runtime / compiler are you using (e.g. python version or version of gcc)

Bazel 9.2.0, bzlmod. Hermetic Clang 20.1.8 via toolchains_llvm, -std=c++20 -Wall. No extra warning flags: -Wdeprecated-declarations is on by default in Clang.

Resolved module versions: [email protected], [email protected], [email protected].

What did you do?

Compile a translation unit that does nothing but include the public umbrella header, against an abseil release from 20260107.0 or later.

repro.cc:

cpp
#include "grpcpp/grpcpp.h"

BUILD.bazel:

python
load("@rules_cc//cc:defs.bzl", "cc_library")

cc_library(
    name = "repro",
    srcs = ["repro.cc"],
    deps = ["@grpc//:grpc++"],
)

MODULE.bazel:

python
bazel_dep(name = "grpc", version = "1.83.0")
bazel_dep(name = "abseil-cpp", version = "20260526.0")

Then bazel build //:repro. The root module's abseil wins under MVS over the 20250512.1 that gRPC's own MODULE.bazel names, which is the normal situation for any consumer that also depends on a current abseil.

What did you expect to see?

A clean compile. The headers under include/grpcpp/ are public, so warnings raised inside them land on every downstream translation unit, and downstream cannot fix them.

What did you see instead?

29 warnings from that single include, all -Wdeprecated-declarations, all inside include/grpcpp/:

external/grpc+/include/grpcpp/completion_queue.h:390:31: warning: 'MutexLock' is deprecated: Use the constructor that takes a reference instead [-Wdeprecated-declarations]
  390 |     grpc::internal::MutexLock l(&server_list_mutex_);
      |                               ^
external/abseil-cpp+/absl/synchronization/mutex.h:633:5: note: 'MutexLock' has been explicitly marked deprecated here
  633 |   [[deprecated("Use the constructor that takes a reference instead")]]
      |     ^

Sites on v1.83.0 (line numbers):

header count lines
grpcpp/support/server_callback.h 22 339 357 387 416 451 499 554 567 580 604 642 659 674 693 716 760 775 797 830 846 868 889
grpcpp/server_context.h 3 427 505 521
grpcpp/completion_queue.h 3 390 397 403
grpcpp/security/tls_certificate_provider.h 1 179

28 are grpc::internal::MutexLock l(&mu) taking the address of a member mutex. grpc::internal::MutexLock is absl::MutexLock via using MutexLock = absl::MutexLock; in src/core/util/sync.h:47, and abseil marked the pointer-taking constructors [[deprecated]] in abseil commit 6d8e1a5c ("Mark legacy Mutex methods and MutexLock pointer constructors as deprecated", 2026-01-06, first shipped in 20260107.0). The reference-taking constructor has existed since 20250814.0.

The remaining one is gRPC's own deprecation of its own type: tls_certificate_provider.h:179 declares UpdateIdentityKeyCertPair(std::vector<IdentityKeyCertPair>) while IdentityKeyCertPair is marked deprecated in favour of IdentityKeyOrSignerCertPair a few lines above.

A generated *.grpc.pb.h pulls in grpcpp/support/client_callback.h as well, which adds 9 more MutexLock sites on 1.83.0 and 11 on 1.84.0 (lines 540 566 594 619 821 841 967 1006 1034 on 1.83.0). So a real service client sees about 40 warnings per translation unit.

1.84.0 does not fix this.

Anything else we should know about your project / environment?

  • The fix on gRPC's side looks mechanical: pass the mutex by reference at these call sites (MutexLock l(mu_)) and add a reference constructor to the non-absl grpc_core::MutexLock class in src/core/util/sync.h so both branches accept it. IdentityKeyCertPair in tls_certificate_provider.h:179 needs either the new type or a suppression around the deprecated declaration.