Large images timeout when image effects are applied to them, can cause CPU spike
Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.
If a large image is added to a Confluence page, and then an image effect is attempted (such as drop shadow), the transformation can timeout. While it's running, it can also cause CPU spikes and take down Confluence in certain situations.
Confluence will display:
The following appears in the
WARN [http-nio-8443-exec-17] [confluence.image.effects.ImageFilterServlet] transformAndRespond Timed out while doing the transform -- referer: https://localhost:8443/conf624/pages/resumedraft.action?draftId=5275657&draftShareId=7b1a548a-bd7d-4919-a0ef-08faf271b2b1 | url: /conf624/download/thumbnails/5275656/myimage.jpg | traceId: f6ea544c01c2fbbf | userName: admin java.util.concurrent.TimeoutException at java.util.concurrent.FutureTask.get(FutureTask.java:205) at com.atlassian.confluence.image.effects.ImageFilterServlet.transformAndRespond(ImageFilterServlet.java:273) at com.atlassian.confluence.image.effects.ImageFilterServlet.writeTransformToResponse(ImageFilterServlet.java:188) at com.atlassian.confluence.image.effects.ImageFilterServlet.doGetInTransaction(ImageFilterServlet.java:155) at com.atlassian.confluence.image.effects.ImageFilterServlet.lambda$doGet$0(ImageFilterServlet.java:132)
Confluence will attempt to apply effects to any image that is under 16MB in size. It will wait for 12 seconds for the transformation to complete, at which point it will time it out. This process is very CPU intensive, so the more resources your server has, the less chance it will run into this problem, unless your server is already very busy. In busy servers, this additional CPU usage can have a destabilising impact.
You can add a JVM parameter that specifies the maximum file size that should be allowed to have an image effect applied to it. The below parameter will set a max size of 1MB. The default is 16MB.