PUN 2 ThreadAbortException
Options
Hi ,
In android on application exit, I get the ThreadAbortException. I do call both
Using the latest asset store version.
In android on application exit, I get the ThreadAbortException. I do call both
chatClient.Disconnect(); chatClient.StopThread();still I get this issue. The issue exists only in IL2CPP build. Here is the message
Using the latest asset store version.
ThreadAbortException
at ExitGames.Client.Photon.SupportClass+<>c__DisplayClass6_0.b__0 () [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ThreadStart.Invoke () [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ContextCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Objec
at ExitGames.Client.Photon.SupportClass+<>c__DisplayClass6_0.b__0 () [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ThreadStart.Invoke () [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ContextCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Objec
0
Comments
-
Hi @Sathyaraj,
From the Unity forum message and via email you provided these details:Lastest store version of PUN2
Unity Version 2019.1.0f2
IL2CPP
.Net 4.x and .net standard 2.0
tried strip engine code on/off
tried c++ compiler config master/release
I tried importing pun2 to an empty project and built a provided sample scene and able to reproduce the issue.
Could you confirm the following:
- PUN version is 2.12
- the target build platform is UWP
- this does not happen on the Unity Editor
- this is 100% reproducible by callingchatClient.Disconnect();
ONLY?
Do you think this other report is related?0 -
Hi,
Yes PUN version is 2.12 also reproducible in 2.9
target platform is Android.
No in Editor it works as expected.
works fine in .net 3.5
No its crashes even without chatClient0 -
Hi @Sathyaraj,
No, no updates on this yet sorry.
This needs until tomorrow or worst case later this week.0 -
Hi @Sathyaraj,
My colleague @Tobias investigated this.
here is what he came up with:
We could not reproduce this on Android 9 and with 2019.1.2f1.
Hint: Just don't build a release .apk. That crashed silently and without hints on the device (even before anything was loaded).
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
0 -
Hi @JohnTube @Tobias
I was able to reproduce this with new 2019.1.7f1
Try to generate the apk with the attached project(Created in 2019.1.7f1)
Press the back button once the app is launched and watch the ADB log
https://drive.google.com/open?id=1B-7bWr1CAZlSPLEmAPMDxJJ8nS5MOgNz
0 -
Hi @Sathyaraj,
I could not reproduce with ZTE Axon 7 (A2017G) running Android 8.0.0.
I downloaded the project and opened using 2019.1.7f1 built Asteroid demo scenes (that's what I found in the build settings as SampleScene is empty), configured AppId in PhotonServerSettings and built and installed on the device.
I tried pressing back button at different times but nothing happens.0 -
I can't repro still.
Maybe there are some PhotonServerSetting I need to change? like background thread?0 -
@JohnTube
https://imgur.com/IrvvzVM
this is my settings and shared the same with you.
Tried in 4 different machines with the same resultThreadAbortException 06-18 17:57:22.759 10990 11042 E Unity : at ExitGames.Client.Photon.SupportClass+<>c__DisplayClass6_0.<StartBackgroundCalls>b__0 () [0x00000] in <00000000000000000000000000000000>:0 06-18 17:57:22.759 10990 11042 E Unity : at System.Threading.ThreadStart.Invoke () [0x00000] in <00000000000000000000000000000000>:0 06-18 17:57:22.759 10990 11042 E Unity : at System.Threading.ContextCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0 06-18 17:57:22.759 10990 11042 E Unity : at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 06-18 17:57:22.759 10990 11042 E Unity : at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 06-18 17:57:22.759 10990 11042 E Unity : at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Objec
0 -
PUN has a background fallback thread that keeps client connected to server. This does not work on iOS (see Background Execution on the Apple dev pages). To keep connection alive, the background thread sends ACKs only to server for a limited time. The default background thread timeout is 60 seconds. You can change it using PhotonNetwork.BackgroundTimeout. After the background timeout, PUN will disconnect the client gracefully. If the client was joined to a room before moving to background PUN will try -if needed- to reconnect and rejoin the same room as soon as the app is foreground again.
[source]
It's weird how starting the background thread throws ThreadAbortException!
Are you sure it's not the other way around?ConnectionHandler.StopFallbackSendAckThread()
andSupportClass.StopBackgroundCalls(byte)
?0 -
Hi @Sathyaraj,
As already mentioned by @Tobias here, an update that includes a fix for this issue will be released next week.0 -
Cool. Thanks0
-
Hi @Sathyaraj,
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 Android, IL2CPP, 4.x runtime.0