question

TJ Daberkow avatar image
TJ Daberkow asked

Unity SDK Crash on Application Quit

We have found an issue with using the Unity SDK and having the web request type set to HttpWebRequest. When it is set to HttpWebRequest the application with crash when either Application.Quit is called or you just close the application normally.

When the request type is set to UnityWebRequest the crash will not happen.

Playfab Unity SDK Version: 2.63.190312

Unity Version: 2018.3.0f2

We need to use the HttpWebRequest type for our server that we are hosting via Playfab container so we would like to resolve the crashing issues with it. When using the UnityWebRequest type none of the Playfab API calls work. See this related issue (https://community.playfab.com/questions/26901/playfab-multiplayer-servers-connection-issues.html)

I am not sure if it is related but we do get this error message from Playfab in the Unity Editor:

ThreadAbortException
System.Threading.Thread.Sleep (System.Int32 millisecondsTimeout) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
PlayFab.Internal.PlayFabWebRequest.WorkerThreadMainLoop () (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:287)
UnityEngine.Debug:LogException(Exception)
PlayFab.Internal.PlayFabWebRequest:WorkerThreadMainLoop() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWebRequest.cs:293)
System.Threading.ThreadHelper:ThreadStart()
unity3d
13 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

jital avatar image jital ♦ commented ·

Hello,

What exactly is going on at the you call Application.Quit? What PlayFab calls are you making if any at the time of quitting? Are there any other outstanding web request that are not PlayFab related that could be taking a while and erroring out?

0 Likes 0 ·
TJ Daberkow avatar image TJ Daberkow jital ♦ commented ·

When we call Application.Quit the app freezes up and crashes.

We narrowed the crash down to Playfab be removing everything else other than a Playfab call to get title data. If we remove the call it will not crash but when added back in it crashes again.

We make the call on app launch but it only crashes when we close or call Application.Quit. So it seems calling any Playfab API with HttpWebRequest will cause the crash when you go to close it.

I have attached the crash log for reference.

crashlog.txt

0 Likes 0 ·
crashlog.txt (50.1 KiB)
jital avatar image jital ♦ TJ Daberkow commented ·

Before your server crashes on exit does the PlayFab API call return successfully?

0 Likes 0 ·
Show more comments

1 Answer

·
TJ Daberkow avatar image
TJ Daberkow answered

@jital Thanks to your suggestion about the Unity Analytics issue we were able to get rid of the crashing. We found that turning off Analytics via the Services tab in Unity did not fix the crashing as I reported before but with further testing we disabled it directly in the "UnityConnectSettings.asset" file by editing it in a text editor. We also had to disable an additional setting in Unity to fully resolve the crashing. Under Player Settings > Other Settings there is an option called "Disable HW Statistics" and we had to make sure that was checked.
Hopefully we will not need to use Unity Analytics in this project since it seems it currently is incompatible with the Http request type of the Playfab SDK. For now though this will resolve our issue.
Thank you for all the help!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.