Error when publishing multiple objects

Enonic version: 6.10.1
OS: Linux

Hello!

We are getting an error when multiple content objects(~500) are getting published via content.modify at the same time. I presume it can be a bug. Here is the the log:

14:30:28.133 ERROR c.e.x.j.i.e.JsonExceptionMapper - Failed to read BufferedImage from InputStream
java.lang.RuntimeException: Failed to read BufferedImage from InputStream
at com.enonic.xp.util.Exceptions.newRuntime(Exceptions.java:33) ~[na:na]
at com.enonic.xp.image.ImageHelper.toBufferedImage(ImageHelper.java:58) ~[na:na]
at com.enonic.xp.core.impl.image.ImageServiceImpl.retrieveBufferedImage(ImageServiceImpl.java:233) ~[na:na]
at com.enonic.xp.core.impl.image.ImageServiceImpl.readBufferedImage(ImageServiceImpl.java:185) ~[na:na]
at com.enonic.xp.core.impl.image.ImageServiceImpl.createImage(ImageServiceImpl.java:71) ~[na:na]
at com.enonic.xp.core.impl.image.ImageServiceImpl.lambda$readImage$0(ImageServiceImpl.java:56) ~[na:na]
at com.enonic.xp.core.impl.image.ImmutableFilesHelper.computeIfAbsent(ImmutableFilesHelper.java:47) ~[na:na]
at com.enonic.xp.core.impl.image.ImageServiceImpl.readImage(ImageServiceImpl.java:56) ~[na:na]
at com.enonic.xp.admin.impl.rest.resource.content.ContentIconResource.resolveResponse(ContentIconResource.java:163) ~[na:na]
at com.enonic.xp.admin.impl.rest.resource.content.ContentIconResource.resolveResponseFromImageAttachment(ContentIconResource.java:133) ~[na:na]
at com.enonic.xp.admin.impl.rest.resource.content.ContentIconResource.getContentIcon(ContentIconResource.java:85) ~[na:na]
at sun.reflect.GeneratedMethodAccessor194.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:137) ~[repack-resteasy-6.10.1.jar:6.10.1]
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:296) ~[repack-resteasy-6.10.1.jar:6.10.1]
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:250) ~[repack-resteasy-6.10.1.jar:6.10.1]
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:237) ~[repack-resteasy-6.10.1.jar:6.10.1]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356) [repack-resteasy-6.10.1.jar:6.10.1]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179) [repack-resteasy-6.10.1.jar:6.10.1]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) [repack-resteasy-6.10.1.jar:6.10.1]
at com.enonic.xp.jaxrs.impl.JaxRsServlet.service(JaxRsServlet.java:46) [jaxrs-impl-6.10.1.jar:6.10.1]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [web-jetty-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.mapping.ServletDefinitionImpl.service(ServletDefinitionImpl.java:39) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.ServletPipelineImpl.service(ServletPipelineImpl.java:30) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:45) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.portal.impl.auth.AuthFilter.doHandle(AuthFilter.java:45) [portal-impl-6.10.1.jar:6.10.1]
at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31) [web-api-6.10.1.jar:6.10.1]
at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33) [web-api-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:40) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.auth.BasicAuthFilter.doHandle(BasicAuthFilter.java:33) [web-impl-6.10.1.jar:6.10.1]
at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31) [web-api-6.10.1.jar:6.10.1]
at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33) [web-api-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:40) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.context.ContextFilter.lambda$doHandle$0(ContextFilter.java:33) [web-impl-6.10.1.jar:6.10.1]
at com.enonic.xp.context.ContextImpl.callWith(ContextImpl.java:101) ~[core-api-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.context.ContextFilter.doHandle(ContextFilter.java:32) [web-impl-6.10.1.jar:6.10.1]
at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31) [web-api-6.10.1.jar:6.10.1]
at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33) [web-api-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:40) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:26) [web-api-6.10.1.jar:6.10.1]
at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33) [web-api-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:40) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dos.DosFilterWrapper.doFilter(DosFilterWrapper.java:64) ~[na:na]
at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:40) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterPipelineImpl.filter(FilterPipelineImpl.java:29) ~[na:na]
at com.enonic.xp.web.impl.dispatch.DispatchServletImpl.service(DispatchServletImpl.java:35) ~[na:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [web-jetty-6.10.1.jar:6.10.1]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:821) ~[na:na]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583) ~[na:na]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[na:na]
at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:365) ~[na:na]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) ~[na:na]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1158) ~[na:na]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511) ~[na:na]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) ~[na:na]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1090) ~[na:na]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[na:na]
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:199) ~[na:na]
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:74) ~[na:na]
at com.enonic.xp.web.vhost.impl.VirtualHostFilter.doHandle(VirtualHostFilter.java:50) ~[na:na]
at com.enonic.xp.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:31) [web-api-6.10.1.jar:6.10.1]
at com.enonic.xp.web.filter.BaseWebFilter.doFilter(BaseWebFilter.java:33) [web-api-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:40) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dos.DosFilterWrapper.doFilter(DosFilterWrapper.java:64) ~[na:na]
at com.enonic.xp.web.impl.dispatch.mapping.FilterDefinitionImpl.doFilter(FilterDefinitionImpl.java:40) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:50) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterChainImpl.doFilter(FilterChainImpl.java:36) [web-dispatch-6.10.1.jar:6.10.1]
at com.enonic.xp.web.impl.dispatch.pipeline.FilterPipelineImpl.filter(FilterPipelineImpl.java:29) ~[na:na]
at com.enonic.xp.web.impl.dispatch.DispatchServletImpl.service(DispatchServletImpl.java:35) ~[na:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [web-jetty-6.10.1.jar:6.10.1]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:821) ~[na:na]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583) ~[na:na]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[na:na]
at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:437) ~[na:na]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) ~[na:na]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1158) ~[na:na]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511) ~[na:na]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) ~[na:na]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1090) ~[na:na]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[na:na]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119) ~[na:na]
at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:240) ~[na:na]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119) ~[na:na]
at org.eclipse.jetty.server.Server.handle(Server.java:517) ~[na:na]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:306) ~[na:na]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242) ~[na:na]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261) ~[na:na]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95) ~[na:na]
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75) ~[na:na]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213) ~[na:na]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147) ~[na:na]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654) ~[na:na]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572) ~[na:na]
at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_112]
Caused by: javax.imageio.IIOException: Unsupported Image Type
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1068) ~[na:1.8.0_112]
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1039) ~[na:1.8.0_112]
at javax.imageio.ImageIO.read(ImageIO.java:1448) ~[na:1.8.0_112]
at javax.imageio.ImageIO.read(ImageIO.java:1352) ~[na:1.8.0_112]
at com.enonic.xp.image.ImageHelper.toBufferedImage(ImageHelper.java:54) ~[na:na]
… 106 common frames omitted
14:30:28.280 ERROR c.e.x.j.i.e.JsonExceptionMapper - Failed to read BufferedImage from InputStream
java.lang.RuntimeException: Failed to read BufferedImage from InputStream

Thanks!

It seems like a legit exception, meaning that it is not able to read the jpeg-image, and doesnt seem to have anything todo with the number of contents. It may be related to this issue:

Can you figure out which image is failing by catching the exception, and try it in a single modify (or post it here :slight_smile:

Hi Runar!

We were trying to do exactly the same things with a single modify and it worked without any exceptions. The image was read correctly and published. It happened when a lot of objects were created/modified only.

Hmmm, ok, then it sounds more like a possible bug.

Do you have a code snippet of what you are doing?

So here is the code for changing the object:

if ( needToModify ) {
            // check modify content
            result = libs.content.modify({
                key: userProfile.profileContentID,
                editor: profileEditor,
                branch: 'draft'
            });		
        }

function profileEditor( c ) {
        c.displayName = preparedUserData['EMPLOYEE_FIRST_NAME'] + ' ' + preparedUserData['EMPLOYEE_LAST_NAME'];
        c.data = userContentObject.data;
        for( var key in preparedUserData ) {
            c.data[key] = preparedUserData[key];
        }
        return c;
    }

And here is the code that publish:

function publishUserProfile( userProfileID ) {
    log.info('Publishing user profile [' + userProfileID + ']');
    var result = libs.content.publish({
    	keys: [userProfileID],
    	sourceBranch: 'draft',
    	targetBranch: 'master',    
    	includeChildren: true,
    	includeDependencies: true,
        schedule: {
            from: new Date().toISOString()            
        }
    });

    if (result) {
        log.info('Pushed ' + result.pushedContents.length + " content.");
    } else {
        log.error('Unable to publish user profile.');
    }
    return result;
}

userProfileID is one entry? What happens if you collect all keys to be published, and publish in one go, is that feasible?

Yes, it is a single entry.
Collecting all keys and publishing all together is something that would require highly a lot of effort and time to do, as this is the script that synchronizes Enonic and another application, which requires response on each object.

ok, no worries. But does this exception occur during the publish or the modify? I dont quite see how the ContentIconResource should be invoked from these operations.

Our logs say that it is getting broken when it is getting published and everything goes fine to the draft branch without any errors.

I have looked at it, and I still cannot figure out where this occurs.

Could you please, if easy to do, wrap your libs.content.publish-statement with try/catch and write out the error message there.

Hi rmy !

We find out that there is no any relation between users import and this error. We have more than 1000 errors in log just for one day. There is no even delay between errors.

10:34:50.341 ERROR c.e.x.j.i.e.JsonExceptionMapper - Failed to read BufferedImage from InputStream
10:34:50.368 ERROR c.e.x.j.i.e.JsonExceptionMapper - Failed to read BufferedImage from InputStream

It looks like that enonic has something like own job to index content and one or more images are not correct. Do you have any idea how to check and fix this ?

Thanks !

Hmmm, why so many errors in the log? Is it application-errors or XP-errors?

Regarding this exception, it seems to originate from Content Studio which is the only place where the icon-stuff is used, when browsing the content.

Sadly, the exception does not give any indications about which image, but my guess is that it is an image with some encoding that the java ImageIO are not able to process. On the good side, this wont affect much, other that not beeing able to show the icon in the content studio list.