Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Property user is corrupt in the datastore:

Hi I get a strange error message: Property user is corrupt in the datastore Can you tell me what it means and what I should do? Here's the full trace

2011-05-04 01:35:15.144

Property user is corrupt in the datastore:
Traceback (most recent call last):
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 958, in _FromPb
    value = datastore_types.FromPropertyPb(prop)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore_types.py", line 1785, in FromPropertyPb
    _strict_mode=False)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/users.py", line 115, in __init__
    assert _auth_domain
AssertionError
Traceback (most recent call last):
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 698, in __call__
    handler.get(*groups)
  File "/base/data/home/apps/classifiedsmarket/dev.350122009565563926/i18n.py", line 266, in get
    ads = Ad.all().filter("modified >", timeline).filter("published =", True).filter("modified <=", bookmark ).order("-modified").fetch(PAGESIZE+1)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/db/__init__.py", line 2025, in fetch
    raw = raw_query.Get(limit, offset, config=config)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 1504, in Get
    batch = batcher.next_batch(limit)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/datastore/datastore_query.py", line 2220, in next_batch
    batch = self.__next_batch.get_result()
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 592, in get_result
    return self.__get_result_hook(self)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/datastore/datastore_query.py", line 1998, in __query_result_hook
    self.__results = self._process_results(query_result.result_list())
  File "/base/python_runtime/python_lib/versions/1/google/appengine/datastore/datastore_query.py", line 2031, in _process_results
    for result in results]
  File "/base/python_runtime/python_lib/versions/1/google/appengine/datastore/datastore_rpc.py", line 127, in pb_to_query_result
    return self.pb_to_entity(pb)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 242, in pb_to_entity
    return Entity._FromPb(pb)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 962, in _FromPb
    (prop.name(), traceback.format_exc()))
Error: Property user is corrupt in the datastore:
Traceback (most recent call last):
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 958, in _FromPb
    value = datastore_types.FromPropertyPb(prop)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore_types.py", line 1785, in FromPropertyPb
    _strict_mode=False)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/users.py", line 115, in __init__
    assert _auth_domain
AssertionError

EDIT: Here is my entire model. I've not changed it for several deployments:

class Ad(GeoModel,search.SearchableModel):   
    primary_image = blobstore.BlobReferenceProperty() 
    ip=db.StringProperty(indexed=False,verbose_name="ip")
    ipcountry=db.StringProperty(indexed=False,verbose_name="origin")
    tags=db.ListProperty(db.Category)
    category=db.CategoryProperty(choices=('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31'),default='1',verbose_name="Category") #numeric for now    
    title=db.StringProperty(verbose_name="title")#required
    type=db.StringProperty(choices=('w','s','r','l','b'),default='s',verbose_name="ContentType")#sell,wanted,rent,lease,buy
    company_ad=db.BooleanProperty(default=False,verbose_name="company_ad")#false or nothing
    user=db.UserProperty(verbose_name="userid") 
    facebookID=db.IntegerProperty(verbose_name="facebook id") 
    twitterID=db.IntegerProperty(verbose_name="twitter id")
    im=db.IMProperty(verbose_name="nickname")#optional, xmpp
    place=db.StringProperty()# postaladdress should work
    url=db.StringProperty(verbose_name="url")
    link=db.LinkProperty(verbose_name="Link")#enable
    geopt=db.GeoPtProperty(verbose_name="geopt") 
    geohash=db.StringProperty(indexed=False,verbose_name="geocode")#should we use this? 
    rating=db.RatingProperty()
    text=db.TextProperty(verbose_name="text")
    currency=db.StringProperty(choices=('EUR','ARS','AUD','BRL','GBP','CAD','CZK','DKK','HKD','HUF','ILS','INR','JPY','MXN','NZD','NOK','PLN','PHP','SGD','SEK','SGD','CHF','USD', 'THB','TWB'),verbose_name = "Currency")
    price=db.StringProperty(verbose_name="price")#floatfree, digits, decimals, regexable or integer valid8able
    phonenumber=db.PhoneNumberProperty(indexed=False,verbose_name="phonenumber")#viewbit
    postaladress=db.PostalAddressProperty(indexed=False,verbose_name="postaladdress")
    phoneview=db.BooleanProperty(default=False,verbose_name="phoneview")#add2phone
    email=db.EmailProperty(indexed=False,verbose_name="Email")#optional
    name=db.StringProperty(verbose_name="Name") 
    #owner=db.UserProperty(verbose_name="Owner") 
    published=db.BooleanProperty(default=True,verbose_name="published")
    #submitted=db.BooleanProperty(default=False,verbose_name="submitted")#edit
    #montao=db.BooleanProperty(default=False,verbose_name="montao")#migr8
    #moderated=db.BooleanProperty(default=False,verbose_name= "moderated")#edit
    added=db.DateTimeProperty(verbose_name="added",auto_now_add=True)#readonly
    modified=db.DateTimeProperty(verbose_name="modified",auto_now_add=True)   
    last_modified = db.DateTimeProperty(required=True, auto_now=True)
    crypted_password=db.StringProperty()#set default true random
    salt=db.StringProperty()# merge with passwrd, set default true random or why even store? counterexample
    timestamp=db.DateTimeProperty(auto_now=True)#backupsystem
    def __unicode__(self):
        return self.title
    def to_json(self):
        data={}
        for prop in self.properties().values():
            data[prop.name] = prop.get_value_for_datastore(self)
        return simplejson(data)    
    def __encrypt(self, plaintext, salt=""):
        """returns the SHA1 hexdigest of a plaintext and salt"""
        phrase = hashlib.sha1()
        phrase.update("%s--%s" % (plaintext, salt))
        return phrase.hexdigest()
    def set_password(self, new_password):
        """sets the user's crypted_password"""
        #from datetime import datetime, timedelta  
        import datetime
        if not self.salt:
            self.salt = self.__encrypt(str(datetime.datetime.now()))
        self.crypted_password = self.__encrypt(new_password, self.salt)
    def check_password(self, plaintext):
        return self.__encrypt(plaintext, self.salt) == self.crypted_password
    def next(self):#enable
        return Ad.all().filter("published =", True).filter("modified >", self.modified).get()    
    def prev(self):#enable
        return Ad.all().filter("published =", True).filter("modified <", self.modified).get()
return levenshtein(self.text,self.prev().text)
    '''
    def uri2view(self):#enable get_serving_url
        return images.get_serving_url(str(self.matched_images.get().primary_image.key()))+'=s100'
    def kmluri2view(self):#enable get_serving_url
        return self.matched_images.get()
    def to_dict(self):
        tempdict1 = dict([(p, unicode(getattr(self, p))) for p in self.properties()])
        tempdict2 = {'key':unicode(self.key())}
        tempdict1.update(tempdict2)
        return tempdict1

EDIT 2: By changing the variable PAGESIZE I can make the page load for the most recent entities. I've not located where the error starts/ends: def get(self, cursor=None, limit=60, PAGESIZE = 1): works and I now try with a larger PAGESIZE ie def get(self, cursor=None, limit=60, PAGESIZE = 10):

like image 973
Niklas Rosencrantz Avatar asked May 04 '11 08:05

Niklas Rosencrantz


2 Answers

This is a known issue with the App Engine datastore. It has nothing to do with your code or app in particular.

The App Engine team is working on a fix, there is a workaround posted here while your waiting: http://groups.google.com/forum/#!topic/google-appengine-python/ClkOIalYD3s

like image 167
RBY Avatar answered Sep 28 '22 07:09

RBY


When an entity is fetched from the datastore, complex property types (as well as the entity itself) are represented as binary-encoded protocol buffers. This error means that the binary data in one particular user field could not be deserialized using the UserProperty protocol buffer definition. It's probably not corrupt, just populated with something other than a UserProperty.

Try loading the entity in question through the datastore viewer to see what's actually stored in the user field.

like image 45
Drew Sears Avatar answered Sep 28 '22 06:09

Drew Sears