Search code examples
javagoogle-app-enginegoogle-cloud-datastoregoogle-cloud-endpointsobjectify

SimpleHttpConnectionManager being used incorrectly w/ Objectify


I'm trying to save multiple datastore entities with Objectify and keep getting dozens of "SimpleHttpConnectionManager being used incorrectly" warnings.

I'm using the following code to save the entities (I've tried with and without the .now() call):

ofy().save().entities(entities).now();

Additionally, after about the first half dozen warnings I get the following exception:

SEVERE: exception occurred while calling backend method
com.google.appengine.tools.remoteapi.RemoteApiException: remote API call: I/O error
Caused by: java.net.SocketTimeoutException: Read timed out

If I iterate through entities and save each entity individually, I don't get any warnings, but this isn't ideal due to the speed and cost of multiple calls to the datastore.

I'm saving around 2500 entities and have tried breaking entities up into multiple lists (under 1000 items), but get the same warnings.

Is this an issue with Objectify or am I missing a step? Should I not be using Objectify at all?


Solution

  • This is unrelated to Objectify. Objectify is a thin layer of code that maps your POJOs to the lower level hashmap-like objects that Google's API uses. For the most part, Objectify operations translate 1-to-1 to low level API calls.

    If you rewrite your app to perform the same operations using the low level API, you'll see this exact same problem. That stacktrace with the RemoteApiException comes from deep inside Google's DatastoreService.put() method.

    I presume you are getting this error from the dev server (it would be VERY odd server-side). Google recently rewrote the app engine dev server and unfortunately it tends to produce opaque errors like this when something goes wrong. I would report this to Google as an error - but make sure to give them the full stacktrace. Scroll down to "Create new App Engine issue" on this page.