straight55b / app-engine-patch

Automatically exported from code.google.com/p/app-engine-patch
0 stars 0 forks source link

DuplicatePropertyError: Class User already has property message_set #127

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Unable to reproduce in dev server, but getting errors in prod.

-----
What is the expected output? What do you see instead?
Here's the stack trace error that we're getting:
Traceback (most recent call last):

 File
"/base/data/home/apps/giftag-prod/2.332308468572333429/common/zip-packages/djang
o-remote.zip/django/core/handlers/base.py",
line 86, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File
"/base/data/home/apps/giftag-prod/2.332308468572333429/gift/views.py", line
848, in clip
   if not gift.has_read_permission(request.user, request):

 File
"/base/data/home/apps/giftag-prod/2.332308468572333429/common/zip-packages/djang
o-remote.zip/django/contrib/auth/middleware.py",
line 5, in __get__
   request._cached_user = get_user(request)

 File
"/base/data/home/apps/giftag-prod/2.332308468572333429/common/zip-packages/djang
o-remote.zip/django/contrib/auth/__init__.py",
line 81, in get_user

 File "/base/python_dist/lib/python2.5/py_zipimport.py", line 240, in
load_module
   exec code in mod.__dict__

 File
"/base/data/home/apps/giftag-prod/2.332308468572333429/common/zip-packages/djang
o-remote.zip/django/contrib/auth/models.py",
line 452, in <module>
   class Message(db.Model):

 File
"/base/data/home/apps/giftag-prod/2.332308468572333429/common/appenginepatch/app
enginepatcher/patch.py",
line 401, in __init__
   not cls._meta.abstract)

 File
"/base/data/home/apps/giftag-prod/2.332308468572333429/common/appenginepatch/app
enginepatcher/patch.py",
line 401, in __init__
   not cls._meta.abstract)

 File "/base/python_lib/versions/1/google/appengine/ext/db/__init__.py",
line 319, in __init__
   _initialize_properties(cls, name, bases, dct)

 File "/base/python_lib/versions/1/google/appengine/ext/db/__init__.py",
line 270, in _initialize_properties
   attr.__property_config__(model_class, attr_name)

 File "/base/python_lib/versions/1/google/appengine/ext/db/__init__.py",
line 2546, in __property_config__
   self.collection_name))

DuplicatePropertyError: Class User already has property message_set

-----
What version of the product are you using? On what operating system?
This started recently after moving to a pre-release of 1.1beta1

-----
Please provide any additional information below.

Have you seen this error before?

-Thomas

Original issue reported on code.google.com by thomasbo...@gmail.com on 14 Apr 2009 at 8:40

GoogleCodeExporter commented 9 years ago
Hi Thomas,
yes, we had this error once. It happens when a Django instance doesn't finish 
loading
for the first time due to a deadline-exceeded exception or a timeout exception 
or
something like that.

In that case half of the code seems to stay loaded in memory. I might add some
detection mechanism for that case, so the half-loaded Django instance gets fully
unloaded when the first load fails (confusing sentence :), but I need to take a
closer look at the real cause of the issue. Maybe it's something different. 
I'll try
to reproduce this by injecting such an exception into the loading process 
manually.

Will do that in the next few days, so the official 1.1 release won't have that 
bug
anymore.

Original comment by wkornew...@gmail.com on 14 Apr 2009 at 10:12

GoogleCodeExporter commented 9 years ago
Unfortunately, no matter what I do, I can't reproduce that bug (neither on dev 
nor on
prod). I've added a little workaround which removes message_set before defining
Message in the hope that this fixes the issue. The only time I had this bug was 
when
an exception got raised on the first request and a db operation raised an
ApplicationError. After that, all subsequent requests raised a 
DuplicatePropertyError
until the failed instance finally got unloaded from RAM. Maybe you could report 
to
Google that after an exception the whole Django instance should get fully 
unloaded or
maybe that ReferenceProperty should never raise a DuplicatePropertyError?

Well, I hope that my workaround fixes the issue.

Original comment by wkornew...@gmail.com on 15 Apr 2009 at 8:18

GoogleCodeExporter commented 9 years ago
I did hit this bug too. I haven't try your workaround.

Original comment by bserg...@gmail.com on 28 Apr 2009 at 12:40

GoogleCodeExporter commented 9 years ago
Actually, yesterday I found the real cause of this issue (and other strange
behavior). It should be fixed in the repo, now.

Original comment by wkornew...@gmail.com on 28 Apr 2009 at 6:43

GoogleCodeExporter commented 9 years ago
I am getting this error in 1.1beta. Will try the repo version & see if it fixes 
my
problem

Original comment by sudhakar...@gmail.com on 25 May 2009 at 9:33

GoogleCodeExporter commented 9 years ago
I am running into the same problem. Where can I get the repo version?

Thanks,

Original comment by yongx...@gmail.com on 27 May 2009 at 12:50

GoogleCodeExporter commented 9 years ago
Look at the "Source" tab at the top.

Original comment by wkornew...@gmail.com on 28 May 2009 at 8:51

GoogleCodeExporter commented 9 years ago
I'm getting this too.. from this model...

from django.contrib.auth.models import User

class Message( db.Expando ):
    user = db.ReferenceProperty( User )
    root = db.SelfReferenceProperty(name="parent")
    title = db.StringProperty( )
    body = db.TextProperty( )
    created = db.DateTimeProperty(  auto_now_add=True)

Original comment by remarkability@gmail.com on 7 Jun 2009 at 6:56

GoogleCodeExporter commented 9 years ago
That's because your model is called "Message" and it has a ReferenceProperty for
User. There already is another model called "Message" with a ReferenceProperty 
to
User in django.contrib.auth.models. Both reference properties generate the same
collection_name, so there is a conflict. You have to specify a custom 
message_name
for your ReferenceProperty.

Original comment by wkornew...@gmail.com on 8 Jun 2009 at 8:44

GoogleCodeExporter commented 9 years ago
So, i also get this problem

Original comment by zhouyudi...@gmail.com on 3 Sep 2012 at 3:13