"ApplicationError: 10: Unknown" when writing to blobstore using FileService

Showing 1-3 of 3 messages
"ApplicationError: 10: Unknown" when writing to blobstore using FileService Mike Prince 8/17/11 5:32 PM
I'm trying to write a Java serialized HashMap<String,Long> to the
blobstore using the FileService and getting an "Unknown" error 10.
I'm guessing there's 10,000+ items in the map.

Below is the code I'm using, followed by the stack trace.

Can someone clue me in on what I'm doing wrong?  And yes, it works
fine in the development environment ;)

Thanks,

Mike


public class Filer
{
        private static final FileService fileService =
FileServiceFactory.getFileService();
        private static final BlobstoreService blobstoreService =
BlobstoreServiceFactory.getBlobstoreService();

        public static String save( Object value )
                throws IOException
        {
                if( value == null ) return null;

                AppEngineFile file = fileService.createNewBlobFile( "text/plain" );
                return save( file, value );
        }

        private static String save( AppEngineFile file, Object value )
                throws IOException
        {
                // Open a channel and write out object
                FileWriteChannel writeChannel = fileService.openWriteChannel( file,
true );
                ObjectOutputStream out = new
ObjectOutputStream( Channels.newOutputStream( writeChannel ) );
                out.writeObject( value );

                // Close it up
                out.close();
                writeChannel.closeFinally();

                return file.getFullPath();
        }



And here's the exception...


org.apache.jsp.tasks.create_002duser_002dsegment_jsp _jspService:
Failed to create user segment
java.io.IOException
        at
com.google.appengine.api.files.FileServiceImpl.translateException(FileServiceImpl.java:
501)
        at
com.google.appengine.api.files.FileServiceImpl.makeSyncCall(FileServiceImpl.java:
479)
        at
com.google.appengine.api.files.FileServiceImpl.append(FileServiceImpl.java:
426)
        at
com.google.appengine.api.files.FileServiceImpl.append(FileServiceImpl.java:
171)
        at
com.google.appengine.api.files.FileWriteChannelImpl.write(FileWriteChannelImpl.java:
49)
        at
com.google.appengine.api.files.FileWriteChannelImpl.write(FileWriteChannelImpl.java:
41)
        at java.nio.channels.Channels.write(Channels.java:80)
        at java.nio.channels.Channels.access$000(Channels.java:64)
        at java.nio.channels.Channels$1.write(Channels.java:151)
        at java.io.ObjectOutputStream
$BlockDataOutputStream.drain(ObjectOutputStream.java:1855)
        at java.io.ObjectOutputStream
$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1764)
        at
java.io.ObjectOutputStream.writeFatalException(ObjectOutputStream.java:
1558)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:
346)
        at com.yumyumlabs.foundation.appengine.util.Filer.save(Filer.java:42)
        at com.yumyumlabs.foundation.appengine.util.Filer.save(Filer.java:33)
        at
com.yumyumlabs.server.recipe.model.UserSegment.saveUsers(UserSegment.java:
51)
        at
org.apache.jsp.tasks.create_002duser_002dsegment_jsp._jspService(create_002duser_002dsegment_jsp.java:
104)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
511)
        at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
390)
        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 org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)
        at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
        at
org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:
213)
        at
org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:
171)
        at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:
145)
        at
org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:
92)
        at
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:
381)
        at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
        at org.machino.servlet.PageTimerFilter.doFilter(PageTimerFilter.java:
63)
        at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
        at org.machino.servlet.LoginFilter.doFilter(LoginFilter.java:121)
        at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
        at org.machino.servlet.RedirectFilter.doFilter(RedirectFilter.java:
53)
        at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
        at
com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:
97)
        at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
        at
com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:
35)
        at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
        at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
43)
        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:
249)
        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:
76)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
        at
com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:
135)
        at
com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:
262)
        at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$2.handleRequest(RuntimePb.java:9819)
        at com.google.net.rpc.impl.RpcUtil.handleRequest(RpcUtil.java:445)
        at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:
414)
        at com.google.net.rpc.impl.Server$RpcTask.runInContext(Server.java:
579)
        at com.google.tracing.TraceContext$TraceContextRunnable
$1.run(TraceContext.java:454)
        at com.google.tracing.TraceContext.runInContext(TraceContext.java:
694)
        at com.google.tracing.TraceContext
$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:
332)
        at com.google.tracing.TraceContext
$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:
324)
        at com.google.tracing.TraceContext
$TraceContextRunnable.run(TraceContext.java:452)
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
1110)
        at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:636)
Caused by: com.google.apphosting.api.ApiProxy$ApplicationException:
ApplicationError: 10: Unknown
        at com.google.apphosting.runtime.ApiProxyImpl
$AsyncApiFuture.rpcFinished(ApiProxyImpl.java:474)
        at com.google.net.rpc.RpcStub$RpcCallbackDispatcher
$1.runInContext(RpcStub.java:1050)
        at com.google.tracing.TraceContext$TraceContextRunnable
$1.run(TraceContext.java:454)
        at com.google.tracing.TraceContext.runInContext(TraceContext.java:
694)
        at com.google.tracing.TraceContext
$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:
332)
        at com.google.tracing.TraceContext
$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:
324)
        at com.google.tracing.TraceContext
$TraceContextRunnable.run(TraceContext.java:452)
        at com.google.net.rpc.RpcStub
$RpcCallbackDispatcher.rpcFinished(RpcStub.java:1071)
        at com.google.net.rpc.RPC.internalFinish(RPC.java:2240)
        at com.google.net.rpc.impl.RpcNetChannel.finishRpc(RpcNetChannel.java:
2338)
        at
com.google.net.rpc.impl.RpcNetChannel.messageReceived(RpcNetChannel.java:
1267)
        at
com.google.net.rpc.impl.RpcConnection.parseMessages(RpcConnection.java:
328)
        at
com.google.net.rpc.impl.RpcConnection.dataReceived(RpcConnection.java:
299)
        at com.google.net.async.Connection.handleReadEvent(Connection.java:
474)
        at
com.google.net.async.EventDispatcher.processNetworkEvents(EventDispatcher.java:
856)
        at
com.google.net.async.EventDispatcher.internalLoop(EventDispatcher.java:
222)
        at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:
116)
        at com.google.net.async.GlobalEventRegistry
$2.runLoop(GlobalEventRegistry.java:95)
        at com.google.net.async.LoopingEventDispatcher
$EventDispatcherThread.run(LoopingEventDispatcher.java:385)
Re: [appengine-java] "ApplicationError: 10: Unknown" when writing to blobstore using FileService Ikai Lan (Google) 8/19/11 10:48 AM
We're surfacing a bad error here. Basically, you get this error message if you hold the file open too long; we recommend around 30 seconds.

I'll file a bug internally to get a better error message. Can you break this up into multiple writes?

--
Ikai Lan 
Developer Programs Engineer, Google App Engine




--
You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group.
To post to this group, send email to google-app...@googlegroups.com.
To unsubscribe from this group, send email to google-appengine-java+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.


Re: "ApplicationError: 10: Unknown" when writing to blobstore using FileService Mike Prince 8/24/11 10:45 AM
Good call - I added BufferedInputStream and BufferedOutputStream and
it solved the problem.

i.e. ObjectOutputStream out = new ObjectOutputStream( new
BufferedOutputStream( Channels.newOutputStream( writeChannel ),
65536 ) );

Thanks!

- Mike

On Aug 19, 10:48 am, "Ikai Lan (Google)" <ika...@google.com> wrote:
> We're surfacing a bad error here. Basically, you get this error message if
> you hold the file open too long; we recommend around 30 seconds.
>
> I'll file a bug internally to get a better error message. Can you break this
> up into multiple writes?
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine
> plus.ikailan.com | twitter.com/ikai
>
>
>
>
>
>
>
> ...
>
> read more »