I'm having competition issues with the Google App Engine and trying to figure out whatβs going on.
I have a request handler annotated with:
@ndb.transactional(xg=True, retries=5)
.. and in this code I am extracting some things, updating some others, etc. But sometimes an error like this comes to the log during the request:
16:06:20.930 suspended generator _get_tasklet(context.py:329) raised TransactionFailedError(too much contention on these datastore entities. please try again. entity group key: app: "s~my-appname"
path <
Element {
type: "PlayerGameStates"
name: "hannes2"
}
>
)
16:06:20.930 suspended generator get(context.py:744) raised TransactionFailedError(too much contention on these datastore entities. please try again. entity group key: app: "s~my-appname"
path <
Element {
type: "PlayerGameStates"
name: "hannes2"
}
>
)
16:06:20.930 suspended generator get(context.py:744) raised TransactionFailedError(too much contention on these datastore entities. please try again. entity group key: app: "s~my-appname"
path <
Element {
type: "PlayerGameStates"
name: "hannes2"
}
>
)
16:06:20.936 suspended generator transaction(context.py:1004) raised TransactionFailedError(too much contention on these datastore entities. please try again. entity group key: app: "s~my-appname"
path <
Element {
type: "PlayerGameStates"
name: "hannes2"
}
>
)
.. followed by a stack trace. I can update the entire stack trace if necessary, but it takes a long time.
I do not understand why this is happening. Looking at a line in my code, an exception appears, I run get_by_id
on a completely different object (Round). "PlayerGameStates", the name "hannes2" mentioned in the error messages, is the parent of another GameState that was get_async
: a few lines from the database earlier;
gamestate_future = GameState.get_by_id_async(id, ndb.Key('PlayerGameStates', player_key))
...
gamestate = gamestate_future.get_result()
...
(?) , , . , , , . , , ...
? ( " .."??) , 5 ndb.transaction ..? , , - .
.