Hi Nick,

Unfortunately, putting the update inside a transaction didn't solve the
problem.  This problem is currently occuring on the SDK, where there
shouldn't be any concurrency issues.  I looked into AppStats again, and I
can clearly seeing the datastore.v3Commit taking place.  And, I am pretty
sure the values are being passed in and set properly.  It just fails a large
portion of the time.  Any other ideas?

Very best and thanks for your help,
Aaron

On Sun, Jun 13, 2010 at 4:47 AM, Nick Johnson (Google) <
[email protected]> wrote:

> Hi Aaron,
>
> Since you're not doing the update inside a transaction, it's likely that
> what's happening is that multiple tasks are updating the entity at the same
> time, which results in a concurrency issue: Both tasks fetch the entity and
> modify it, and the one that does the put last is the one whose results are
> visible.
>
> Doing the update in a transaction should fix this.
>
> -Nick Johnson
>
> On Sun, Jun 13, 2010 at 8:50 AM, Aaron Cheung <[email protected]>wrote:
>
>> Hi guys,
>>
>> I'm still having trouble debugging this error.  Would appreciate any
>> thoughts!
>>
>> Thanks,
>> Aaron
>>
>>
>> On Sat, Jun 12, 2010 at 3:55 AM, Aaron <[email protected]> wrote:
>>
>>> Hi!
>>>
>>> I am currently implementing the deferred library in my code, and I am
>>> running into a very very strange problem.  The function that I am
>>> deferring gets passed an entity key.  It does two tasks: 1) Gets the
>>> entity,  retrieves a reference property, alters it, and then puts it
>>> back 2)Sends out an email
>>>
>>> The email is getting sent out every time the deferred function is
>>> called.  BUT, the first task only completes 2/3 of the time.  I have
>>> been replicating this error over and over and have yet to find any
>>> pattern in the failures.  Here is the deferred function
>>>
>>> def complete_insert(self, data, answer_key, userkey):
>>>        a = db.get(answer_key)
>>>        q = a.question
>>>        q.answercount += 1
>>>        q.answerers += [str(userkey)]
>>>        q.answerers = list(set(q.answerers))
>>>        q.answered = True
>>>        q.lastanswer = str(answer_key)
>>>        q.lastanswerdate = datetime.now()
>>>        q.put()
>>>
>>>        mail = Mail()
>>>        followers = db.get(q.indexes.followerlist)
>>>        emails = []
>>>        for follower in followers:
>>>            mail.send(emails, "question-followers-email", params =
>>> {"question": common.strip_html(q.question),
>>> "details":common.strip_html(q.details), "slug":q.slug,
>>> "answer":common.strip_html(data["answer"])} )
>>>
>>> A couple observations that make this even more boggling.  I can tell
>>> when the function fails because the counter does not increment and the
>>> other properties do not change.  However, when it fails, I can see the
>>> put() being done in AppStats under /ah/deferred.  FURthermore, I have
>>> checked that the values being passed into the function are the ones
>>> that I am expecting.  (I did this by adding another put that wrote the
>>> arguments to a test model)
>>>
>>> I have absolutely no idea what could be going on here.  Is this a bug?
>>>
>>> Very best and thanks for your time,
>>> Aaron
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Google App Engine" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected]<google-appengine%[email protected]>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-appengine?hl=en.
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<google-appengine%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine?hl=en.
>>
>
>
>
> --
> Nick Johnson, Developer Programs Engineer, App Engine Google Ireland Ltd.
> :: Registered in Dublin, Ireland, Registration Number: 368047
> Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number:
> 368047
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-appengine%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to