Backport 6907 to v4.x (console.* not working when running out of stack space)
Checklist
-
tests and code linting passes -
a test and/or benchmark is included -
the commit message follows commit guidelines
Affected core subsystem(s)
vm, module
Description of change
Backport of #6907 to v4.x