google-code-export / appengine-devappserver2-experiment

Automatically exported from code.google.com/p/appengine-devappserver2-experiment
0 stars 0 forks source link

Saving ndb models no longer working #52

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to save any ndb model instance

Ran this in the interactive console to demonstrate issue:

from google.appengine.ext import ndb

class User(ndb.Model):
  username = ndb.StringProperty()

new_user = User(username='test')
new_user.put()

What is the expected output? What do you see instead?
Expect the model to save, instead I get this stack trace:

Traceback (most recent call last):
  File "/opt/devserver2/google/appengine/tools/devappserver2/python/request_handler.py", line 151, in handle_interactive_request
    exec(compiled_code, self._command_globals)
  File "<string>", line 7, in <module>
  File "/opt/devserver2/google/appengine/ext/ndb/model.py", line 3187, in _put
    return self._put_async(**ctx_options).get_result()
  File "/opt/devserver2/google/appengine/ext/ndb/tasklets.py", line 325, in get_result
    self.check_success()
  File "/opt/devserver2/google/appengine/ext/ndb/tasklets.py", line 368, in _help_tasklet_along
    value = gen.throw(exc.__class__, exc, tb)
  File "/opt/devserver2/google/appengine/ext/ndb/context.py", line 733, in put
    key = yield self._put_batcher.add(entity, options)
  File "/opt/devserver2/google/appengine/ext/ndb/tasklets.py", line 368, in _help_tasklet_along
    value = gen.throw(exc.__class__, exc, tb)
  File "/opt/devserver2/google/appengine/ext/ndb/context.py", line 280, in _put_tasklet
    keys = yield self._conn.async_put(options, datastore_entities)
  File "/opt/devserver2/google/appengine/ext/ndb/tasklets.py", line 454, in _on_rpc_completion
    result = rpc.get_result()
  File "/opt/devserver2/google/appengine/api/apiproxy_stub_map.py", line 604, in get_result
    return self.__get_result_hook(self)
  File "/opt/devserver2/google/appengine/datastore/datastore_rpc.py", line 1569, in __put_hook
    self.check_rpc_success(rpc)
  File "/opt/devserver2/google/appengine/datastore/datastore_rpc.py", line 1222, in check_rpc_success
    rpc.check_success()
  File "/opt/devserver2/google/appengine/api/apiproxy_stub_map.py", line 570, in check_success
    self.__rpc.CheckSuccess()
  File "/opt/devserver2/google/appengine/api/apiproxy_rpc.py", line 156, in _WaitImpl
    self.request, self.response)
  File "/opt/devserver2/google/appengine/ext/remote_api/remote_api_stub.py", line 200, in MakeSyncCall
    self._MakeRealSyncCall(service, call, request, response)
  File "/opt/devserver2/google/appengine/ext/remote_api/remote_api_stub.py", line 234, in _MakeRealSyncCall
    raise pickle.loads(response_pb.exception())
TypeError: 'NoneType' object has no attribute '__getitem__'

What version of the product are you using? On what operating system?

0.8 on Arch Linux (64-bit)

Please provide any additional information below.

Code worked fine in previous versions of the devappserver2

Original issue reported on code.google.com by prat...@referabuyer.com on 11 Mar 2013 at 10:02

GoogleCodeExporter commented 9 years ago
Yeah, this is a bad regression.

Original comment by bquin...@google.com on 12 Mar 2013 at 10:37

GoogleCodeExporter commented 9 years ago
Hi, could you post your app config? I'm trying to reproduce this, but no luck 
so far.

Also, do you get the same error if you start the dev_appserver with 
--auto_id_policy=sequential?

Thanks!

Original comment by roh...@google.com on 12 Mar 2013 at 11:39

GoogleCodeExporter commented 9 years ago
Also, are you loading a local datastore from a previous SDK version or from a 
previous version of the same SDK?

If so, could you please try running with --clear_datastore (back up your old 
data first) or with --datastore_path=<some other, possibly empty local 
datastore>, and see if the error still occurs?

Thanks very much. Still looking into it, but currently cannot reproduce.

Original comment by roh...@google.com on 13 Mar 2013 at 12:05

GoogleCodeExporter commented 9 years ago
I launch the dev server with: 
--require_indexes --log_level='debug' --datastore_path=...

So yes, I'm using a previous database.

Works fine if I point the --datastore_path parameter to something new/fresh.

Original comment by prat...@referabuyer.com on 13 Mar 2013 at 12:21

GoogleCodeExporter commented 9 years ago
I see. Unfortunately we don't guarantee backwards compatibility of local 
datastores across SDK versions, although we do strive to maintain it.

I'm still not sure what's causing the issue in this case, as I've just run a 
test using your demo code above, which succeeds in writing a 1.7.5 datastore, 
then reading from it and writing to it in the 1.7.6 SDK. However, it's quite 
possible the issue is triggered by some aspect of your configuration that I'm 
missing.

If you're willing to share the datastore file in question I'll try again to 
repro the issue. Otherwise, if it's possible to regenerate your local datastore 
in the new SDK, I would recommend that for now.

I'll update this thread if or when we have a solution for migrating local 
datastores across SDK versions.

Thanks!

Original comment by roh...@google.com on 13 Mar 2013 at 5:02

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Status update: a workaround for now is to set --auto_id_policy=sequential when 
you start the dev appserver. That should allow you to write to your existing 
dev datastore from 1.7.6.

There is no need to regenerate your data. This problem occurs when you try to 
write to a SQLite dev datastore created with SDK version 1.7.4 or earlier from 
the 1.7.6 SDK.

We are working on a fix for this. Thanks again for reporting it.

Original comment by roh...@google.com on 13 Mar 2013 at 5:42