Sign In Register

How can we help you today?

Start a new topic

GSInstance.SetUserId called twice in short period can block durableQueue


I'm not 100% sure if this is only GameSparks issue, but I've noticed this in one of my projects:

When GameSparks is initialized while Unity is on high load, GSInstance.SetUserId can set durableQueuePaused private field to true and never recover for that state. In result, none of durable calls (SetDurable) are not being sent.

The SetUserId method does something like this:

1. Remembers current durableQueuePaused state as local variable.

2. The queue is set to paused

3. Sends a delegate to GSPlatform.ExecuteOnMainThread

4. This delegate does something and then restores durableQueuePaused from a local variable set in point 1. Usually unpauses it.

The reason of that is the assumption in SetUserId method that main thread delegate will get called between two successive SetUserId calls. It does not always get to happen and the queue get infinitely paused. In my case the order looks like this:

- First call, step 1 - queue is not paused, remembers this

- First call step 2 - pausing queue

- First call step 3 - Queuing a delegate

- Second call step 1 - queue is still paused, remembers this

- Second call step 2, 3 - Queuing a delegate

- First call step 4 - Queue remembered as not paused is unpaused

- Second call step 4 - Queue remembered as paused is paused again.



Hi Piotr,

What version of the (Unity?) SDK are you using here ? If you create a new project and try to recreate this issue are you able to reproduce the issue in question ? 



1. Newest at time of reporting this issue.

2. Sorry, don't have the time to create similar reproduction case. It's a simple race condition bug, just look into your code.

Login to post a comment