0

Hi maybe it is a stupid question but currently I am testing on using spanner with appengine. However I have problem even running an empty transaction neither local nor remote environment. I have tried both mvm and flex.

What I basically did is just run a trivial transaction

System.out.println("HELLO")
TransactionRunner.TransactionCallable callable =  new TransactionRunner.TransactionCallable<Void>() {

        @Nullable
        @Override
        public Void run(TransactionContext transaction) throws Exception {
                System.out.println("WORLD")

        }}

databaseClient.readWriteTransaction().run(callable);

However this code seems to be blocking at the last line and takes forever to return. I tried the same code (and with more complex transaction logic) outside of appengine and it is just working as expected.

Again it is very simple example I am trying to follow but however I cannot get it. So I am wondering what might possible go wrong.

EDIT:

Sorry my bad, i don't think it is a problem about transaction. I have tried just do a singeUse read it is also blocking forever. So I suspecting there is some permission issue that I need to set up for spanner on appengine? However I really couldn't find it anywhere in doc...

EDIT:

After waiting a while, get stacktrace like this

Exception in thread "grpc-default-executor-0" java.lang.NullPointerException
    at com.google.appengine.tools.development.RequestEndListenerHelper.getListeners(RequestEndListenerHelper.java:52)
    at com.google.appengine.tools.development.RequestEndListenerHelper.register(RequestEndListenerHelper.java:39)
    at com.google.appengine.tools.development.RequestThreadFactory$1$1.start(RequestThreadFactory.java:65)
    at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:950)
    at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1368)
    at io.grpc.auth.GoogleAuthLibraryCallCredentials.applyRequestMetadata(GoogleAuthLibraryCallCredentials.java:100)
    at io.grpc.internal.CallCredentialsApplyingTransportFactory$CallCredentialsApplyingTransport.newStream(CallCredentialsApplyingTransportFactory.java:98)
    at io.grpc.internal.DelayedClientTransport$PendingStream.createRealStream(DelayedClientTransport.java:392)
    at io.grpc.internal.DelayedClientTransport$PendingStream.access$100(DelayedClientTransport.java:379)
    at io.grpc.internal.DelayedClientTransport$2.run(DelayedClientTransport.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at com.google.appengine.tools.development.RequestThreadFactory$1$1$2.run(RequestThreadFactory.java:110)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.google.appengine.tools.development.RequestThreadFactory$1$1.run(RequestThreadFactory.java:107)
Josh Lee
  • 171,072
  • 38
  • 269
  • 275
Xinwei Liu
  • 333
  • 6
  • 15
  • 1
    Which AppEngine environment are you using? Spanner only works in the flexible environment. – Daniel Compton Apr 04 '17 at 00:02
  • actually just confirmed i am using mvm, which is flexible environment. – Xinwei Liu Apr 04 '17 at 00:37
  • have you tried w/ a simple read? I saw something similar in AppEngine standard, but would like to make sure. also, which version of the client library? what's the maven coordinate? – saturnism Apr 04 '17 at 17:33
  • yea i have tried, updated in the post, it is not only transaction. any single read write is not working. i am using client version `com.google.cloud:google-cloud-spanner:0.9.4-beta` – Xinwei Liu Apr 04 '17 at 17:40
  • As Daniel mentioned, Cloud Spanner client works only in flex environment. I would recommend you to take a look at `src/main/appengine/app.yaml`, and check that `env: flex` is set. Also check the `pom.xml` file and make sure that appengine SDK is not included. com.google.appengine appengine-api-1.0-sdk – Mairbek Khadikov Apr 25 '17 at 19:47

0 Answers0