Forum BigDB Successcallback out of sync or something?

Discussion and help relating to the PlayerIO database solution, BigDB.

Successcallback out of sync or something?

Postby default0 » November 21st, 2010, 5:07 pm

Hey

experiencing a pretty weird behaviour with bigdbs successcallback for saving db objects.

First a code snippet, then further explanation:
Code: Select all
player.myObj.Set("x", player.x);
player.myObj.Set("y", player.y);
player.myObj.Save(
    delegate // success callback
    {
        player.Send("jump");
    }
);


So far, so good.
Basically this code snippet saves the new positions that are assigned to the player by warping and then tells the client to disconnect from the server and connect to the new server it's been assigned to.
This is done with grace, and the new server then SHOULD load the coordinates that were assigned to the player, since the save already occured and has been successful.
But of course, the server prefers to give me a headache: The old coordinates are still being loaded, and hell, the new map that is assigned and loaded from the exact same db object is the map it's supposed to be. So the save occured, or...?
With that not enough, it sometimes works, sometimes not.
Each time it does not work, I get a neat null reference exception in my error log (from serverside), giving me the question: What could be null? I thought "It's obvious: The reference to "player" has been garbaged before the successcallback could execute!" and shortly after figured "omg, this cannot be, since the player does actually receive the message!".

So, this pretty much leaves me with a whole bunch of confusion and whatnot...
Any ideas? =/

And please save me the trouble with the easiest suggestion: The coordinates are assigned correct, I did use Console.WriteLine() and ErrorLog.WriteError() to verify this myself, and these are ALWAYS the correct ones, even if the code fails, also wrong set coordinates would in no way explain the null reference exception.

Best regards
Try to play my Game: -->BlackGalaxy<--
User avatar
default0
 
Posts: 115
Joined: February 2nd, 2010, 6:46 pm
Location: Germany

Re: Successcallback out of sync or something?

Postby Oliver » November 22nd, 2010, 12:50 pm

Hey,

Questions:
- How often do you save x&y? Perhaps you're accidentally overwriting them from another part of your game

Statements:
- The player object is not garbage collected. That simply can't happen when you yourself have the reference to it.
(it might be that something inside .Send() is null)

Can you isolate this down to a simple testcase that reproduces the error that we can use to fix it?

Best,
Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Successcallback out of sync or something?

Postby default0 » November 22nd, 2010, 5:19 pm

Oliver wrote:Hey,

Questions:
- How often do you save x&y? Perhaps you're accidentally overwriting them from another part of your game

Statements:
- The player object is not garbage collected. That simply can't happen when you yourself have the reference to it.
(it might be that something inside .Send() is null)

Can you isolate this down to a simple testcase that reproduces the error that we can use to fix it?

Best,
Oliver


To your question: Probably not, only changes I am making to this outside of the specified msg handler are accumulative, meaning the player may be positioned a little more left or right - but not completely elsewhere (and I can reproduce this easily in my game)

And to your statemend, I don't know how a constant string should be null :)

And for your kind question: I will try, but there's no promise, and I am fairly sure it will take me some time, I will post it right here once I'm done with it :)

Also, for the "randomness" in which this is happening: I am fairly sure this got something to do with how long it takes until the save callback is called.

Best regards
Try to play my Game: -->BlackGalaxy<--
User avatar
default0
 
Posts: 115
Joined: February 2nd, 2010, 6:46 pm
Location: Germany

Re: Successcallback out of sync or something?

Postby Oliver » November 22nd, 2010, 10:12 pm

And to your statemend, I don't know how a constant string should be null


I didn't mean that the constant string was null, but rather that the something inside the execution of the Send method was null.
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Successcallback out of sync or something?

Postby default0 » November 22nd, 2010, 10:16 pm

Oliver wrote:
And to your statemend, I don't know how a constant string should be null


I didn't mean that the constant string was null, but rather that the something inside the execution of the Send method was null.


Ah okay, also, on another note (but probably not related to this issue) I once got a timer error that code execution took too long for PlayerIOData event, no clue what this is, but maybe you could look into this, too.

I will try to make you an isolated test-case tomorrow, wish me luck, I'm not sure if I'm able to reproduce it reliably.

Best regards
Try to play my Game: -->BlackGalaxy<--
User avatar
default0
 
Posts: 115
Joined: February 2nd, 2010, 6:46 pm
Location: Germany

Re: Successcallback out of sync or something?

Postby Benjaminsen » November 23rd, 2010, 9:44 am

Would be great with a screenshot of the null error you receive when this happens.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Successcallback out of sync or something?

Postby default0 » November 23rd, 2010, 3:12 pm

Okay, maybe, hopefully, it was something on my end that should be fixed right now.
If it happens ever again (did several tests and it worked this time) I will be sure to inform you again.
Also, I could not reproduce anything like this reliably, which makes me believe that it really was on my end this time.

Thanks for helping out, and oliver, in the end it appears you have been right with overwriting x/y, it just happened in a way I would have never expected it to begin with.
Now let's hope this will never occur again :) (I could never reproduce this 100% so I cannot exclude the possibility of it happening again)

Best regards and thanks
Try to play my Game: -->BlackGalaxy<--
User avatar
default0
 
Posts: 115
Joined: February 2nd, 2010, 6:46 pm
Location: Germany


Return to BigDB