Backport #7170 to beta changelog: none (fixes stack overflow, but this was introduced in this release cycle)