Skip to content

503 unavailable response from datastore after app has idled for a few minutes #1265

@heidmotron

Description

@heidmotron

I've been getting this response in both production and locally (using the production datastore):

{ [Error]
  code: 503,
  metadata: Metadata { _internal_repr: {} },
  response: '' }

The error is thrown from here - https://github.com/grpc/grpc/blob/release-0_13_1/src/node/src/client.js#L411

Steps to reproduce:

  1. Make a http request "/" that hits datastore
  2. Wait a few minutes and don't make an http request that hits the datastore
  3. Make a http request "/" that hits datastore

Expect: Datastore to return results
Actual: 503 unavailable

  1. Immediately make a http request "/" that hits datastore

The datastore will work and continue to work for another few minutes.
I've deployed the bookstore sample app and it seems to have the same behavior saying "Something broke!".

Here is the code:

var gcloud = require('gcloud')({
    projectId: 'app'
});
var datastore = gcloud.datastore();

var app = express();
app.disable('etag');
app.set('trust proxy', true);


app.get('/', function(req, res, next) {
    var query = datastore.createQuery('Post').filter("Status", "staged");

    datastore.runQuery(query, function(err, posts) {
        if (err) {
            console.log(err.message)
            console.log(err.code)
            console.log(err.metadata)
            next(err)
        } else {
            res.status(200).send("Posts staged = " + posts.length)
        }
    })

});

I'm using the default app credentials and Flexible VMs. Let me know if there is any other info I could provide.

Metadata

Metadata

Assignees

Labels

coretype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions