Search Issue Tracker

Active

Votes

0

Found in

2017.4.0a1

2020.1.0a23

Issue ID

1219728

Regression

No

Editor and crash reporter both hang upon stack overflow in recursive component script with logging

Scripting

-

Editor and crash reporter both hang upon stack overflow in recursive component script

When adding a recursive function which may result in a stack overflow to a component script, the Unity Editor and Crash Reporter will both hang indefinitely. No error is provided and the user will need to kill both processes to recover. This can be reproduced with the following component script:

using UnityEngine;
using UnityEditor;

public class RecursiveComponent : MonoBehaviour
{
void Update()
{
Overflow(0);
}

int Overflow(int start)
{
Debug.Log("Ping");
return start + Overflow(start);
}
}

Steps to reproduce:
- Create a new Unity Project and paste and attach the above script to any object in a scene
- Enter Play Mode
- Observe the editor will hang
- Observe the crash reporter process will also hang

UPDATE: If the logging is removed, Unity appears to then sometimes catch the stack overflow. With logs in place it fails to catch and will hang.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.