SupportClass StopBackgroundCalls aborts thread causing ThreadAbortException

I currently get ThreadAbortExceptions and after some investigation it seems to be caused by an unhandled exception in:
public static bool StopBackgroundCalls(byte id)
    {
      if (SupportClass.threadList == null || (int) id > SupportClass.threadList.Count || SupportClass.threadList[(int) id] == null)
        return false;
      SupportClass.threadList[(int) id].Abort();
      return true;
    }
PUN v2.12

Any ideas on this please?

Comments

  • Does not occur in unity editor but can be found in UWP build
  • JohnTubeJohnTube mod
    edited June 7
    Hi @wassx,

    Thank you for your report!

    Is this the same report as in here?

    What Unity version do you use?
    What is the scripting backend (IL2CPP or mono?) or mono/.Net version?
    Is this 100% reproducible? could you reproduce with our demos in a clean fresh empty project with just PUN2 imported?
  • Hi @wassx,

    There are issues cropping up in Unity 2019 and we would not be surprised if this is fixed since the original release.
    Please update Unity and try to repro.

    release history of 2019.1.1:

    IL2CPP: Fixed an intermittent crash when a managed exception occurs on a back ground thread while the process is shutting down.


    release history of 2019.1.2:
    Services: Fix crash in signal handler on Android IL2CPP ARM64
  • Hi @JohnTube
    Thanks for the hint!
    Sry was busy the last days:
    I used unity 2018.3.14f1 and IL2CPP. Had no time to create a minimum test example to reproduce, maybe I get the chance in a few days.
    I'll try to update.
    Thank you!
  • TobiasTobias admin
    wassx said:

    Does not occur in unity editor but can be found in UWP build

    If this really happens in UWP, this should be reported to Unity as a bug. For UWP, we use a ThreadPoolTimer. To stop this, we use timer.Cancel which has no exception:
    https://docs.microsoft.com/en-us/uwp/api/windows.system.threading.threadpooltimer.cancel

    On all other builds, we start catching the exception of the Thread. This comes in PUN v4.13 (or more precisely in the lib it will contain: v4.1.2.16).
  • Hi @JohnTube i found in the other thread that an update will come this week. I'll wait for this one and test again.
  • Hey @wassx

    ICYMI:

    PUN 2.13 is out with a new library v4.1.2.16 in its changelog:

    "Fixed: Each thread created via SupportClass.StartBackgroundCalls will now try-catch a ThreadAbortException. Apparently, the handling of a ThreadAbortException changed with Unity 2019, which started to log the exceptions on IL2CPP, 4.x runtime."
Sign In or Register to comment.