Manually backport #27104 without tests because too many conflicted files to backport it completely. (cherry picked from commit 5c96a2be87)
5c96a2be87