Exposing images - how to resolve a 560 error?

1
Hi there, I have a GET endpoint and in one of the attributes I am storing a URL to an image that is stored by Mendix. Example url: https://application.mendixcloud.com/images/equipment.jpg. I am using the PublicImagePath module to generate the link. The URL is used to show images in a React frontend. Most of the times, the images is showing just fine, but in some cases, I am getting a 560 error from Mendix. This results in some images that are not shown. Does anyone know what can cause an error like this? I am using the REST Services Module (not native REST) in this project.  Does anybody know what to do? Thanks! Error log frontend: https://app.mendixcloud.com/images/equipment.jpg https://app/images/equipment.jpg Request Method: GET Status Code: 560 Remote Address: 18.194.83.203:443 Referrer Policy: no-referrer-when-downgrade content-length: 0 date: Fri, 25 May 2018 13:00:27 GMT server: nginx status: 560 x-vcap-request-id: 9cb47d55-97b5-4d8b-5510-d4979a92f24b :authority: app.mendixcloud.com :method: GET :path: /images/equipment.jpg :scheme: https accept: image/webp,image/apng,image/*,*/*;q=0.8 accept-encoding: gzip, deflate, br accept-language: nl-NL,nl;q=0.9,en-US;q=0.8,en;q=0.7 cache-control: no-cache cookie: originURI=/login.html; xasid=0.8ce649a9-7c8a-46ed-a416-a76295f435c0; XASSESSIONID=6b9d37e7-ed29-42f2-b974-0e2fee87b2ca pragma: no-cache referer: http://localhost:3000/category-overview user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36 Update:  Error log in Mendix: com.mendix.systemwideinterfaces.MendixRuntimeException: org.eclipse.jetty.io.EofException at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36) Caused by: org.eclipse.jetty.io.EofException: null at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:292) at org.eclipse.jetty.io.WriteFlusher.flush(WriteFlusher.java:429) at org.eclipse.jetty.io.WriteFlusher.write(WriteFlusher.java:322) at org.eclipse.jetty.io.AbstractEndPoint.write(AbstractEndPoint.java:372) at org.eclipse.jetty.server.HttpConnection$SendCallback.process(HttpConnection.java:756) at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:241) at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:224) at org.eclipse.jetty.server.HttpConnection.send(HttpConnection.java:522) at org.eclipse.jetty.server.HttpChannel.sendResponse(HttpChannel.java:735) at org.eclipse.jetty.server.HttpChannel.write(HttpChannel.java:786) at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:234) at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:218) at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:509) at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1720) at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1696) at org.apache.commons.io.IOUtils.copy(IOUtils.java:1671) at publicimagepath.helpers.IOUtilsWrapper.copy(IOUtilsWrapper.java:18) at publicimagepath.usecases.ServeImages.serve(ServeImages.java:133) at publicimagepath.usecases.PublicImagePathHandler.processRequest(PublicImagePathHandler.java:47) at com.mendix.externalinterface.connector.RequestHandler.doProcessRequest(RequestHandler.java:40) at com.mendix.external.connector.MxRuntimeConnector$1.execute(MxRuntimeConnector.java:71) at com.mendix.external.connector.MxRuntimeConnector$1.execute(MxRuntimeConnector.java:68) at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32) at com.mendix.external.connector.MxRuntimeConnector.processRequest(MxRuntimeConnector.java:74) at com.mendix.basis.impl.MxRuntimeImpl.processRequest(MxRuntimeImpl.java:858) at com.mendix.m2ee.appcontainer.server.handler.RuntimeHandler.service(RuntimeHandler.java:42) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) 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.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:561) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:334) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:104) 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:243) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:679) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:597) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: De software op uw hostcomputer heeft een verbinding verbroken at sun.nio.ch.SocketDispatcher.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) at sun.nio.ch.IOUtil.write(IOUtil.java:51) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471) at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:270) at org.eclipse.jetty.io.WriteFlusher.flush(WriteFlusher.java:429) at org.eclipse.jetty.io.WriteFlusher.write(WriteFlusher.java:322) at org.eclipse.jetty.io.AbstractEndPoint.write(AbstractEndPoint.java:372) at org.eclipse.jetty.server.HttpConnection$SendCallback.process(HttpConnection.java:756) at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:241) at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:224) at org.eclipse.jetty.server.HttpConnection.send(HttpConnection.java:522) at org.eclipse.jetty.server.HttpChannel.sendResponse(HttpChannel.java:735) at org.eclipse.jetty.server.HttpChannel.write(HttpChannel.java:786) at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:234) at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:218) at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:509) at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1720) at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1696) at org.apache.commons.io.IOUtils.copy(IOUtils.java:1671) at publicimagepath.helpers.IOUtilsWrapper.copy(IOUtilsWrapper.java:18) at publicimagepath.usecases.ServeImages.serve(ServeImages.java:133) at publicimagepath.usecases.PublicImagePathHandler.processRequest(PublicImagePathHandler.java:47) at com.mendix.externalinterface.connector.RequestHandler.doProcessRequest(RequestHandler.java:40) at com.mendix.external.connector.MxRuntimeConnector$1.execute(MxRuntimeConnector.java:71) at com.mendix.external.connector.MxRuntimeConnector$1.execute(MxRuntimeConnector.java:68) at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:32) at com.mendix.external.connector.MxRuntimeConnector.processRequest(MxRuntimeConnector.java:74) at com.mendix.basis.impl.MxRuntimeImpl.processRequest(MxRuntimeImpl.java:858) at com.mendix.m2ee.appcontainer.server.handler.RuntimeHandler.service(RuntimeHandler.java:42) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) 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.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:561) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:334) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:104) 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:243) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:679) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:597) at java.lang.Thread.run(Thread.java:745)    
asked
2 answers
4

This part from the stacktrace

Caused by: java.io.IOException: De software op uw hostcomputer heeft een verbinding verbroken

makes me believe that it is a connection issue and that this is not a Mendix specific issue.

answered
2

Update:

The problem occured when a new request to load the image was done while another request was still in progress. 

If 'fixed' the issue by using an Image CDN ( https://www.imgix.com/ ) to  cache the images. 

answered