title: Error while reading from Google Cloud Storage
body: <p>I'm trying to read a file from Cloud storage got <code>"Unexpected cause of ExecutionException"</code> error. the below is the full stacktrace.<br><br>
  size of the file is 20MB. <br><br></p>
  
  <blockquote>
    <p>com.google.appengine.tools.cloudstorage.NonRetriableException:
    java.lang.RuntimeException:
    com.google.appengine.tools.cloudstorage.SimpleGcsInputChannelImpl$1@ef713e:
    Unexpected cause of ExecutionException
          at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:120)
          at com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:166)
          at com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:156)
          at com.google.appengine.tools.cloudstorage.SimpleGcsInputChannelImpl.read(SimpleGcsInputChannelImpl.java:84)
          at DownloadAttachment.doGet(DownloadAttachment.java:194)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
          at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
          at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
          at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
          at com.pw.budgeting.integration.SynchronizationMessageFilter.doFilter(SynchronizationMessageFilter.java:34)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:168)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.pw.features.FeatureFilter.doFilter(FeatureFilter.java:39)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.pw.security.AuthenticationFilter.doFilter(AuthenticationFilter.java:43)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.pw.security.SchemaFilter.doFilter(SchemaFilter.java:36)
          at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
          at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
          at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
          at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
          at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
          at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:37)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
          at com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:60)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
          at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:50)
          at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
          at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
          at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
          at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
          at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
          at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
          at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:260)
          at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
          at org.mortbay.jetty.Server.handle(Server.java:326)
          at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
          at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
          at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:78)
          at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
          at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:148)
          at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:468)
          at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:437)
          at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:444)
          at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:256)
          at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:308)
          at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:300)
          at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:441)
          at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:235)
          at java.lang.Thread.run(Thread.java:745)
        Caused by: java.lang.RuntimeException: com.google.appengine.tools.cloudstorage.SimpleGcsInputChannelImpl$1@ef713e:
    Unexpected cause of ExecutionException
          at com.google.appengine.tools.cloudstorage.SimpleGcsInputChannelImpl$1.call(SimpleGcsInputChannelImpl.java:105)
          at com.google.appengine.tools.cloudstorage.SimpleGcsInputChannelImpl$1.call(SimpleGcsInputChannelImpl.java:84)
          at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:108)
          ... 82 more
        Caused by: com.google.apphosting.api.ApiProxy$UnknownException: An error occurred for the API request urlfetch.Fetch().
          at com.google.apphosting.runtime.ApiProxyImpl.statusException(ApiProxyImpl.java:650)
          at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.setRpcError(ApiProxyImpl.java:603)
          at com.google.apphosting.runtime.ApiProxyImpl$AsyncApiFuture.failure(ApiProxyImpl.java:591)
          at com.google.apphosting.runtime.stubby.StubbyCallbackAdapter.failure(StubbyCallbackAdapter.java:25)
          at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher$1.runInContext(RpcStub.java:864)
          at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:444)
          at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:256)
          at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:308)
          at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:300)
          at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:441)
          at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher.runCallback(RpcStub.java:900)
          at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher.rpcFinished(RpcStub.java:910)
          at com.google.net.rpc3.client.RpcStub$RpcCallbackDispatcher.failure(RpcStub.java:895)
          at com.google.net.rpc3.impl.client.RpcClientInternalContext.runCallbacks(RpcClientInternalContext.java:1229)
          at com.google.net.rpc3.impl.client.RpcClientInternalContext.finishRpcAndNotifyApp(RpcClientInternalContext.java:1126)
          at com.google.net.rpc3.impl.client.RpcNetChannel.afterFinishingActiveRpc(RpcNetChannel.java:1557)
          at com.google.net.rpc3.impl.client.RpcNetChannel.finishRpc(RpcNetChannel.java:1377)
          at com.google.net.rpc3.impl.client.RpcNetChannel.handleResponse(RpcNetChannel.java:3139)
          at com.google.net.rpc3.impl.client.RpcNetChannel.messageReceived(RpcNetChannel.java:2875)
          at com.google.net.rpc3.impl.client.RpcNetChannel.access$2900(RpcNetChannel.java:179)
          at com.google.net.rpc3.impl.client.RpcNetChannel$TransportCallback.receivedMessage(RpcNetChannel.java:4081)
          at com.google.net.rpc3.impl.client.RpcChannelTransportData$TransportCallback.receivedMessage(RpcChannelTransportData.java:669)
          at com.google.net.rpc3.impl.wire.RpcBaseTransport.receivedMessage(RpcBaseTransport.java:457)
          at com.google.apphosting.runtime.udrpc.UdrpcTransport$ClientAdapter.receivedMessage(UdrpcTransport.java:338)
          at com.google.apphosting.runtime.udrpc.UdrpcTransport.dispatchPacket(UdrpcTransport.java:187)
          at com.google.apphosting.runtime.udrpc.AbstractUdrpcTransport.readPackets(AbstractUdrpcTransport.java:202)
          at com.google.apphosting.runtime.udrpc.AbstractUdrpcTransport.access$000(AbstractUdrpcTransport.java:30)
          at com.google.apphosting.runtime.udrpc.AbstractUdrpcTransport$1.run(AbstractUdrpcTransport.java:57)
          at com.google.net.eventmanager.AbstractFutureTask$Sync.innerRun(AbstractFutureTask.java:260)
          at com.google.net.eventmanager.AbstractFutureTask.run(AbstractFutureTask.java:121)
          at com.google.net.eventmanager.EventManagerImpl.runTask(EventManagerImpl.java:594)
          at com.google.net.eventmanager.EventManagerImpl.internalRunWorkerLoop(EventManagerImpl.java:1012)
          at com.google.net.eventmanager.EventManagerImpl.runWorkerLoop(EventManagerImpl.java:892)
          at com.google.net.eventmanager.WorkerThreadInfo.runWorkerLoop(WorkerThreadInfo.java:161)
          at com.google.net.eventmanager.EventManagerImpl$WorkerThread.run(EventManagerImpl.java:1877)</p>
  </blockquote>
  
  <p><br>
  <br>
  My code is : </p>
  
  <pre><code>GcsFilename keyAsAFileName = new GcsFilename(contentBucketName, key);
  GcsFileMetadata gcsFileMetadata = gcsService.getMetadata(keyAsAFileName);
              ByteBuffer result = null;
              if (gcsFileMetadata != null) {
                  result = ByteBuffer.allocate((int)gcsFileMetadata.getLength());
                  if(gcsFileMetadata.getLength()&gt;0){
                      readChannel = gcsService.openReadChannel(keyAsAFileName, 0);
                      readChannel.read(result);
                  }
              }
  </code></pre>
  
  <p>Please help.</p>