Forum BigDB Error: Could not grab locks for objects

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

Error: Could not grab locks for objects

Postby cjcenizal » June 3rd, 2011, 4:23 pm

I'm getting the following run-time error in my AS3: "Error: Could not grab locks for objects: there was too much access to the given objects in the allotted time."

This error has shown up out of the blue (last night my game ran fine, and this morning the error appeared). I've been able to narrow the cause of the error down to this code, which previously caused no problems:

Code: Select all
if ( _playerObject[ SIGNUP_DATE ] == undefined ) {
    _playerObject[ SIGNUP_DATE ] = TimeUtils.getUTC();
}
if ( _playerObject[ MUTE ] == undefined ) {
    _playerObject[ MUTE ] = DefaultPlayerValues.mute;
}
if ( _playerObject[ NAME ] == undefined ) {
    _playerObject[ NAME ] = _facebook.name;
}
if ( _playerObject[ NEW ] == undefined ) {
    _playerObject[ NEW ] = 1;
}
if ( _playerObject[ TUTORIAL ] == undefined ) {
    _playerObject[ TUTORIAL ] = 1;
}
if ( _playerObject[ BACKGROUND ] == undefined ) {
    _playerObject[ BACKGROUND ] = 0;
}
_playerObject[ GAME_NAME ] = _facebook.firstName;
_playerObject[ ONLINE ] = 1;
_playerObject.save();


This code initializes the user. If I comment out a few of the above lines, but leave the save(), the problem disappears.

EDIT: OK, I just uncommented all of the lines, so my code is now back to its original state, and the problem is gone. But the cause of the error is really disturbing. If this happens to a user, s/he is essentially done as a player because I won't know how to diagnose or solve the player's problem.
cjcenizal
Paid Member
 
Posts: 115
Joined: March 29th, 2011, 12:31 am

Re: Error: Could not grab locks for objects

Postby Oliver » June 3rd, 2011, 5:31 pm

The problem happens when there are many writers trying to write to the exact same object at the exact same time... That, or one of our sync-servers was misbehaving. Most likely it's the last case, since we had one of them do just that today a couple of times.

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

Re: Error: Could not grab locks for objects

Postby cjcenizal » June 3rd, 2011, 5:53 pm

Great! Thanks for the explanation. There's only one current user (me), so the latter one sounds like our culprit.
cjcenizal
Paid Member
 
Posts: 115
Joined: March 29th, 2011, 12:31 am

Re: Error: Could not grab locks for objects

Postby Oliver » June 9th, 2011, 10:32 am

It was most likely the latter case, but i just wanted to point out that i can also happen from a single client, if that client is sending tons of saves at the same time.

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

Re: Error: Could not grab locks for objects

Postby cjcenizal » June 9th, 2011, 4:42 pm

Thanks for the info Oliver, I'll keep it in mind!
cjcenizal
Paid Member
 
Posts: 115
Joined: March 29th, 2011, 12:31 am

Re: Error: Could not grab locks for objects

Postby bettycooper » November 15th, 2022, 5:05 am

This error occurs when you try to grab an object that has already been grabbed by another object. It's usually caused by a typo in your code, but it can also be caused by a bug in the AS3 framework.

If you're getting this error, try deleting the object that you're trying to grab and re-creating it. If the error persists, you may have a bug in your code.io games

If you're getting this error, make sure that your code is being executed as a single thread.
bettycooper
 
Posts: 2
Joined: November 15th, 2022, 5:02 am


Return to BigDB