Backport #11033 to 4-0-stable

Backport of #11033 to 4-0-stable.

/cc @fxn