loicteixeira / gj-unity-api

[MOVED] Game Jolt API wrapper for Unity.
https://github.com/InfectedBytes/gj-unity-api/
MIT License
16 stars 13 forks source link

Client crashes with SSL/Too Many Thread errors #72

Closed loicteixeira closed 7 years ago

loicteixeira commented 7 years ago

Reported by @Voyder_Rozann on GameJolt.

An SSL error shows after login in:

Unknown SSL protocol error in connection to s.gjcdn.net:443
UnityEngine.Debug:LogWarning(Object)
GameJolt.API.Core.Response:.ctor(WWW, ResponseFormat) (at Assets/Plugins/GameJolt/Scripts/API/Core/Response.cs:29)
GameJolt.API.<GetRequest>c__Iterator0:MoveNext() (at Assets/Plugins/GameJolt/Scripts/API/Manager.cs:108)

And about 5s later, the client crashed with too many threads.

loicteixeira commented 7 years ago

Script used by @Voyder_Rozann.

// Do not pay attention to the "ImageEffect, Bloom... Etc..."
// It's just for viewing correctly the GameJolt Log In menu.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.ImageEffects;

public class Restart_API : MonoBehaviour
{
    public Camera cam1;
    public static bool isSignedIn;
    public int LoggedIn;

    private void Start()
    {
        cam1.gameObject.GetComponent<Bloom>().bloomThreshold = 1f;
        LoggedIn = PlayerPrefs.GetInt("LOGIN1", 0);

        if (LoggedIn == 0)
        {
            GameJolt.UI.Manager.Instance.ShowSignIn((bool success) =>
            {
                if (success)
                {
                    LoggedIn = 1;
                    cam1.gameObject.GetComponent<Bloom>().bloomThreshold = 0.6f;
                }
                else
                {
                    LoggedIn = 2;
                    cam1.gameObject.GetComponent<Bloom>().bloomThreshold = 0.6f;
                }
            });
        }
    }

    private void OnApplicationQuit()
    {
        LoggedIn = 0;
    }

    private void OnDestroy()
    {
        PlayerPrefs.SetInt("LOGIN1", LoggedIn);
    }

    private void Update()
    {
        if (GameJolt.API.Manager.Instance.CurrentUser != null)
        {
            isSignedIn = true;
        }

        if (LoggedIn == 1 || LoggedIn == 2)
        {
            cam1.gameObject.GetComponent<Bloom>().bloomThreshold = 0.6f;
        }
    }
}
loicteixeira commented 7 years ago

Can't reproduce.

FWIW, the API does not use SSL so I wonder if this was a network issue, with GameJolt trying some redirects?

loicteixeira commented 7 years ago

The user confirmed that the issue was caused by the PlayerPrefs and that after erasing them, everything worked again.