First, thanks for the great lib! I have a single problem with it so far, and here it is 🙂
When an image fails to load (no network, bad URL, any time of error I've tested), the HTTP call is retried as fast as possible without any delay, maxing out the CPU. Additionally, the onFailure block is recomposed every time this happens, since we're throwing a new exception on every cycle.
This might cause a DDOS on the server that is supposed to serve the request, and in my case leads to throttling of the API I'm using.
How to reproduce:
In io.kamel.samples.Gallery, set ItemsCount to 1. This will make it easier to see the problem.
In io.kamel.samples.Utils, break the URL so that it fails to load any image. For example, change picsum.photos to picsum.phtos.
In io.kamel.samples.SampleImage, in the onFailure block, add a log directive such as println(exception).
Run ./gradlew :kamel-samples:run and observe the logs.
What happens:
The log is spammed with java.nio.channels.UnresolvedAddressException as fast as the CPU can handle.
What was expected:
I see a single Exception logged. Alternatively, the image load is retried every N seconds, with N configurable in KamelConfig.
The effect can also be observed on an image with crossfade = true and a loading placeholder, you can see the image fade in and out as fast as it can.
First, thanks for the great lib! I have a single problem with it so far, and here it is 🙂
When an image fails to load (no network, bad URL, any time of error I've tested), the HTTP call is retried as fast as possible without any delay, maxing out the CPU. Additionally, the
onFailure
block is recomposed every time this happens, since we're throwing a new exception on every cycle.This might cause a DDOS on the server that is supposed to serve the request, and in my case leads to throttling of the API I'm using.
How to reproduce:
io.kamel.samples.Gallery
, setItemsCount
to1
. This will make it easier to see the problem.io.kamel.samples.Utils
, break the URL so that it fails to load any image. For example, changepicsum.photos
topicsum.phtos
.io.kamel.samples.SampleImage
, in theonFailure
block, add a log directive such asprintln(exception)
../gradlew :kamel-samples:run
and observe the logs.What happens:
The log is spammed with
java.nio.channels.UnresolvedAddressException
as fast as the CPU can handle.What was expected:
I see a single Exception logged. Alternatively, the image load is retried every
N
seconds, withN
configurable inKamelConfig
.The effect can also be observed on an image with
crossfade = true
and a loading placeholder, you can see the image fade in and out as fast as it can.Thanks!