For what it's worth, I have an application where the "client.cas(key, 
counter+1)" which has worked for years, and it practically a direct copy of 
Guido's code on the page below, is suddenly failing in the past few days.  

http://neopythonic.blogspot.com/2011/08/compare-and-set-in-memcache.html

I've debugged the code extensively.  It isn't that complex.  But something 
certainly changed on App Engine.
I've tried variations of setting the initial value.
I've tried cas_reset().
I've tried flushing the cache just before the request.
"client.cas(key, counter+1)" is simply returning False every time during 
the while True loop, eventually timing out after 30 seconds.


On Friday, February 10, 2017 at 1:43:22 PM UTC-6, Nicholas (Google Cloud 
Support) wrote:
>
> Hey adriano_brasileiro,
>
> I was not able to reproduce the results you describe.  This might require 
> additional investigation which is better suited to the App Engine public 
> issue tracker.  I recommend that you file an issue there and posting a link 
> to that issue here so that others may follow.
>
> When doing so, please include the following:
>
>    - Timestamps for when you first and last noticed this issue occurring
>    - Does it happen only when reaching a certain load?
>    - Are there any other modules contending with this memcache?
>
> Also, I'd suggest using the *memcache.Client().add()* rather than the 
> static *memcache.add()*.  Lastly, the code you provide suggests that 
> *memcache.Client().get()* returns a dict but it in fact returns the value 
> of a key 
> <https://cloud.google.com/appengine/docs/python/refdocs/google.appengine.api.memcache#google.appengine.api.memcache.Client.get>
>  
> or *None*.
>
> I look forward to seeing you issue report.
>
> On Thursday, February 9, 2017 at 11:45:16 AM UTC-5, 
> [email protected] <javascript:> wrote:
>>
>> I have an application in which I use the memcache to avoid race 
>> conditions by retrieving keys using get(..., for_cas=True) and saving using 
>> cas. However, ever since yesterday 18:00 (GMT-02) cas is always returning 
>> False for me. Even a code as simple as this:
>>
>> memcache.add('key', 'A')
>> memclient = memcache.Client()
>> dict = memclient.get('key', for_cas=True)
>> result = memclient.cas('key', 'B')
>>
>> print result
>>
>> always returns False on a clean memcache. I have tried to run this code 
>> in different applications and result is always False. If i change the code 
>> to use traditional get() and set(), result returns True. I havent done a 
>> deploy in three days, so the code haven't changed as the problem started to 
>> appear. Did something change in the sdk?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/f5fceb0d-cf04-4f62-9f62-b55255a5b33c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-appengine]... adriano_brasileiro
    • [google-appen... 'Nicholas (Google Cloud Support)' via Google App Engine
      • [google-a... Carlos
        • [goog... 'Nicholas (Google Cloud Support)' via Google App Engine
          • [... adriano_brasileiro
            • ... 'Nicholas (Google Cloud Support)' via Google App Engine
              • ... Carlos
                • ... 'Nicholas (Google Cloud Support)' via Google App Engine

Reply via email to