mckoss / pageforest

Automatically exported from code.google.com/p/pageforest
0 stars 0 forks source link

PUSH method fails with server error 500 if blob is larger than 600 bytes #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Steps to Reproduce:

- Visit http://chat.pageforest.com/#chat
- Sign in
- Try to submit a message

Results: 500 Internal Server Error

Expected: The message should appear in the chat.

Notes: The problem is that the storage for blobs larger than 600 bytes is now 
in a separate model called Chunk, no longer in the Blob model. But the push 
happens inside a datastore transaction, so it can only deal with one entity (or 
entity group using ancestor queries).

Error log and traceback:

67.136.217.98 - - [09/Aug/2010:09:36:31 -0700] "POST 
/docs/chat/messages?method=push HTTP/1.1" 500 1459 
"http://chat.pageforest.com/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; 
en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8,gzip(gfe),gzip(gfe)" 
"chat.pageforest.com" ms=315 cpu_ms=136 api_cpu_ms=0 cpm_usd=0.004031

Exception in request:
Traceback (most recent call last):
  File "/base/python_runtime/python_lib/versions/third_party/django-1.1/django/core/handlers/base.py", line 92, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/base/data/home/apps/pageforest/2010-08-05.343878986113589934/utils/decorators.py", line 57, in wrapper
    return func(request, *args, **kwargs)
  File "/base/data/home/apps/pageforest/2010-08-05.343878986113589934/blobs/views.py", line 53, in dispatch
    response = view_function(request)
  File "/base/data/home/apps/pageforest/2010-08-05.343878986113589934/blobs/views.py", line 291, in blob_push
    length = push_transaction(request, value, max_length)
  File "/base/data/home/apps/pageforest/2010-08-05.343878986113589934/utils/decorators.py", line 25, in wrapper
    return db.run_in_transaction(func, *args, **kwargs)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 2143, in RunInTransaction
    DEFAULT_TRANSACTION_RETRIES, function, *args, **kwargs)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 2234, in RunInTransactionCustomRetries
    result = function(*args, **kwargs)
  File "/base/data/home/apps/pageforest/2010-08-05.343878986113589934/blobs/views.py", line 275, in push_transaction
    blob.value = json.dumps(array)
  File "/base/data/home/apps/pageforest/2010-08-05.343878986113589934/blobs/models.py", line 93, in __setattr__
    if not Chunk.exists(self.sha1):
  File "/base/data/home/apps/pageforest/2010-08-05.343878986113589934/utils/mixins/cacheable.py", line 255, in exists
    return bool(query.count())
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/db/__init__.py", line 1717, in count
    result = raw_query.Count(limit=limit, rpc=rpc)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 1271, in Count
    req = self._ToPb(limit=limit)
  File "/base/python_runtime/python_lib/versions/1/google/appengine/api/datastore.py", line 1449, in _ToPb
    'Only ancestor queries are allowed inside transactions.')
BadRequestError: Only ancestor queries are allowed inside transactions.

Original issue reported on code.google.com by jcrocholl on 9 Aug 2010 at 4:50

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 98999e68d0.

Original comment by jcrocholl on 10 Aug 2010 at 11:52

GoogleCodeExporter commented 9 years ago

Original comment by mckoss@gmail.com on 4 Nov 2010 at 11:49