enonic / app-explorer

Other
1 stars 3 forks source link

Listing status failes for a while, then goes back to normal #50

Closed runarmyklebust closed 4 years ago

runarmyklebust commented 5 years ago

Some times, after starting collector-jobs, the listing of status fails with exception for a while before working again, typically a couple of minutes(?):

SyntaxError: Invalid JSON: <json>:1:0 Expected json literal but found E Error: Finished with 3 errors. ^ com.enonic.xp.web.WebException: SyntaxError: Invalid JSON: <json>:1:0 Expected json literal but found E Error: Finished with 3 errors. ^ at com.enonic.xp.web.impl.exception.ExceptionMapperImpl.map(ExceptionMapperImpl.java:32) at com.enonic.xp.portal.handler.BasePortalHandler.handleError(BasePortalHandler.java:60) at com.enonic.xp.portal.handler.BasePortalHandler.doHandle(BasePortalHandler.java:52) at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:66) at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30) at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75) at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30) at com.enonic.xp.web.impl.trace.TraceWebFilter.doHandle(TraceWebFilter.java:38) at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:66) at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30) at com.enonic.xp.web.impl.handler.WebDispatcherImpl.dispatch(WebDispatcherImpl.java:50) at com.enonic.xp.web.impl.handler.WebDispatcherServlet.doHandle(WebDispatcherServlet.java:135) at com.enonic.xp.web.impl.handler.WebDispatcherServlet.service(WebDispatcherServlet.java:63) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at com.enonic.xp.web.impl.dispatch.mapping.ServletDefinitionImpl.service(ServletDefinitionImpl.java:39) at com.enonic.xp.web.impl.dispatch.pipeline.ServletPipelineImpl.service(ServletPipelineImpl.java:40) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:45) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) at com.enonic.xp.portal.impl.idprovider.IdProviderFilter.doHandle(IdProviderFilter.java:45) at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31) at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33) at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:40) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) at com.enonic.xp.web.impl.auth.BasicAuthFilter.doHandle(BasicAuthFilter.java:33) at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31) at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33) at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:40) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) at com.enonic.xp.web.impl.context.ContextFilter.lambda$doHandle$0(ContextFilter.java:33) at com.enonic.xp.context.ContextImpl.callWith(ContextImpl.java:101) at com.enonic.xp.web.impl.context.ContextFilter.doHandle(ContextFilter.java:32) at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31) at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33) at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:40) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:26) at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33) at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:40) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) at com.enonic.xp.web.impl.dos.DosFilterWrapper.doFilter(DosFilterWrapper.java:65) at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:40) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) at com.enonic.xp.web.impl.dispatch.pipeline.FilterPipelineImpl.filter(FilterPipelineImpl.java:39) at com.enonic.xp.web.impl.dispatch.DispatchServletImpl.service(DispatchServletImpl.java:49) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:860) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:420) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:203) at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:73) at com.enonic.xp.web.vhost.impl.VirtualHostFilter.doHandle(VirtualHostFilter.java:53) at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31) at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33) at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:40) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) at com.enonic.xp.web.impl.dos.DosFilterWrapper.doFilter(DosFilterWrapper.java:65) at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:40) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50) at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) at com.enonic.xp.web.impl.dispatch.pipeline.FilterPipelineImpl.filter(FilterPipelineImpl.java:39) at com.enonic.xp.web.impl.dispatch.DispatchServletImpl.service(DispatchServletImpl.java:49) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:860) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:527) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:530) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626) at java.base/java.lang.Thread.run(Unknown Source) Caused by: com.enonic.xp.resource.ResourceProblemException: SyntaxError: Invalid JSON: <json>:1:0 Expected json literal but found E Error: Finished with 3 errors. ^ at com.enonic.xp.resource.ResourceProblemException$Builder.build(ResourceProblemException.java:131) at com.enonic.xp.script.impl.util.ErrorHelper.doHandleException(ErrorHelper.java:54) at com.enonic.xp.script.impl.util.ErrorHelper.handleError(ErrorHelper.java:27) at com.enonic.xp.script.impl.value.FunctionScriptValue.call(FunctionScriptValue.java:41) at com.enonic.xp.script.impl.executor.ScriptExportsImpl.executeMethod(ScriptExportsImpl.java:56) at com.enonic.xp.portal.impl.controller.ControllerScriptImpl.doExecute(ControllerScriptImpl.java:71) at com.enonic.xp.portal.impl.controller.ControllerScriptImpl.lambda$execute$0(ControllerScriptImpl.java:36) at com.enonic.xp.trace.Tracer.traceEx(Tracer.java:72) at com.enonic.xp.trace.Tracer.trace(Tracer.java:51) at com.enonic.xp.trace.Tracer.trace(Tracer.java:98) at com.enonic.xp.portal.impl.controller.ControllerScriptImpl.execute(ControllerScriptImpl.java:36) at com.enonic.xp.portal.impl.handler.service.ServiceHandlerWorker.execute(ServiceHandlerWorker.java:105) at com.enonic.xp.portal.impl.handler.service.ServiceHandler.doHandle(ServiceHandler.java:63) at com.enonic.xp.portal.impl.handler.service.ServiceHandler.doHandle(ServiceHandler.java:22) at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:66) at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30) at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75) at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30) at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75) at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30) at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75) at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30) at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75) at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30) at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75) at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30) at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75) at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30) at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75) at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30) at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75) at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30) at com.enonic.xp.web.handler.BaseWebHandler.handle(BaseWebHandler.java:75) at com.enonic.xp.web.impl.handler.WebHandlerChainImpl.handle(WebHandlerChainImpl.java:30) at com.enonic.xp.portal.handler.BasePortalHandler.doHandle(BasePortalHandler.java:46) ... 107 common frames omitted Caused by: jdk.nashorn.internal.runtime.ECMAException: SyntaxError: Invalid JSON: <json>:1:0 Expected json literal but found E Error: Finished with 3 errors. ^ at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ECMAErrors.error(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ECMAErrors.syntaxError(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ECMAErrors.syntaxError(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.JSONFunctions.parse(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.internal.objects.NativeJSON.parse(Unknown Source) at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$2645$1479A$listCollectors.L:1#L:1-6#u#body(com.enonic.app.explorer:/services/listCollectors/listCollectors.js:1) at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunction.invoke(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptRuntime.apply(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.internal.objects.NativeArray$10.forEach(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.arrays.IteratorAction.apply(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.internal.objects.NativeArray.map(Unknown Source) at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$2639$1403$listCollectors.L:1#L:1-6#u(com.enonic.app.explorer:/services/listCollectors/listCollectors.js:1) at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunction.invoke(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptRuntime.apply(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.api.scripting.ScriptObjectMirror.call(Unknown Source) at com.enonic.xp.script.impl.value.FunctionScriptValue.call(FunctionScriptValue.java:36) ... 138 common frames omitted Caused by: jdk.nashorn.internal.runtime.ParserException: <json>:1:0 Expected json literal but found E Error: Finished with 3 errors. ^ at jdk.scripting.nashorn/jdk.nashorn.internal.parser.JSONParser.error(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.internal.parser.JSONParser.error(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.internal.parser.JSONParser.expectedError(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.internal.parser.JSONParser.parseLiteral(Unknown Source) at jdk.scripting.nashorn/jdk.nashorn.internal.parser.JSONParser.parse(Unknown Source) ... 153 common frames omitted

ComLock commented 5 years ago

This probably happens because I have packed a javascript data structure into progress.info via JSON.stringify. And then when something goes wrong progress sends back an info string which cannot be parsed by JSON.parse.

ComLock commented 5 years ago

A lot has changed in app-explorer, I'm assuming you have observed this in FHI?

ComLock commented 5 years ago

Calculating averageMs time per progress item also did not handle the current item was 0