Backport #30801 by wxiaoguang Fix #30792 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> (cherry picked from commit ab2ef1ae49bc5e81d0debac85aee687a64fde8b3)