[GH-ISSUE #522] Same image content returned for different image URLs when loading within short timeframe #796

Closed
opened 2026-03-15 15:30:52 +03:00 by kerem · 3 comments
Owner

Originally created by @ebner on GitHub (Oct 9, 2024).
Original GitHub issue: https://github.com/flyimg/flyimg/issues/522

Originally assigned to: @sadok-f on GitHub.

Describe the bug

When loading multiple images at the same time from the same host it happens that flyimg returns the same content for different image URLs.

To Reproduce

I created the following script (flyimg.sh) to showcase the problem:

#!/bin/bash

function dl() {
  #sleep $((RANDOM % 50))
  wget -O - -o /dev/null 'https://demo.flyimg.io/upload/w_300,q_90/'$1 | md5sum -b | cut -d' ' -f 1
}

function run() {
  dl 'https://images.citybreakcdn.com/image.aspx?ImageId=8175306' &
  dl 'https://images.citybreakcdn.com/image.aspx?ImageId=7697905' &
  dl 'https://images.citybreakcdn.com/image.aspx?ImageId=7697901' &
  dl 'https://images.citybreakcdn.com/image.aspx?ImageId=7697904' &
  dl 'https://images.citybreakcdn.com/image.aspx?ImageId=7805696' &
  dl 'https://images.citybreakcdn.com/image.aspx?ImageId=7805566' &
  dl 'https://images.citybreakcdn.com/image.aspx?ImageId=8091782' &
  dl 'https://images.citybreakcdn.com/image.aspx?ImageId=8065687' &
  dl 'https://images.citybreakcdn.com/image.aspx?ImageId=8169185' &
  dl 'https://images.citybreakcdn.com/image.aspx?ImageId=8170556' &
}

run
wait

You can pipe the script output into sort and uniq to easily detect how often the duplicate content situation occurs:

./flyimg.sh | sort | uniq -c | sort -r

When uncommenting the sleep command in the first line of the dl() method it can be seen that the problem does not occur that frequently. This indicates a concurrency problem in flyimg.

Expected behavior

The script above should return 10 unique MD5 hashes.

Environment setup:

The problem can be reproduced with a local Docker instance of flyimg as well as demo.flyimg.io.

Originally created by @ebner on GitHub (Oct 9, 2024). Original GitHub issue: https://github.com/flyimg/flyimg/issues/522 Originally assigned to: @sadok-f on GitHub. **Describe the bug** When loading multiple images at the same time from the same host it happens that flyimg returns the same content for different image URLs. **To Reproduce** I created the following script (`flyimg.sh`) to showcase the problem: ``` #!/bin/bash function dl() { #sleep $((RANDOM % 50)) wget -O - -o /dev/null 'https://demo.flyimg.io/upload/w_300,q_90/'$1 | md5sum -b | cut -d' ' -f 1 } function run() { dl 'https://images.citybreakcdn.com/image.aspx?ImageId=8175306' & dl 'https://images.citybreakcdn.com/image.aspx?ImageId=7697905' & dl 'https://images.citybreakcdn.com/image.aspx?ImageId=7697901' & dl 'https://images.citybreakcdn.com/image.aspx?ImageId=7697904' & dl 'https://images.citybreakcdn.com/image.aspx?ImageId=7805696' & dl 'https://images.citybreakcdn.com/image.aspx?ImageId=7805566' & dl 'https://images.citybreakcdn.com/image.aspx?ImageId=8091782' & dl 'https://images.citybreakcdn.com/image.aspx?ImageId=8065687' & dl 'https://images.citybreakcdn.com/image.aspx?ImageId=8169185' & dl 'https://images.citybreakcdn.com/image.aspx?ImageId=8170556' & } run wait ``` You can pipe the script output into `sort` and `uniq` to easily detect how often the duplicate content situation occurs: `./flyimg.sh | sort | uniq -c | sort -r` When uncommenting the sleep command in the first line of the `dl()` method it can be seen that the problem does not occur that frequently. This indicates a concurrency problem in flyimg. **Expected behavior** The script above should return 10 unique MD5 hashes. **Environment setup:** The problem can be reproduced with a local Docker instance of flyimg as well as demo.flyimg.io.
kerem 2026-03-15 15:30:52 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@sadok-f commented on GitHub (Oct 9, 2024):

Hi @ebner
Thank you for reporting this issue!
I'll look into it as soon as possible.

<!-- gh-comment-id:2402331932 --> @sadok-f commented on GitHub (Oct 9, 2024): Hi @ebner Thank you for reporting this issue! I'll look into it as soon as possible.
Author
Owner

@sadok-f commented on GitHub (Oct 9, 2024):

Hi @ebner
I just released a fix for the issue you reported, thank you again.
One thing regarding the ? symbol: It needs to be encoded to be accepted in the image URL parameters ? => %3F
so your script should look like this:

#!/bin/bash

function dl() {
  #sleep $((RANDOM % 50))
  wget -O - -o /dev/null 'https://demo.flyimg.io/upload/w_300,q_90/'$1 | md5sum -b | cut -d' ' -f 1
}

function run() {
  dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=8175306' &
  dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=7697905' &
  dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=7697901' &
  dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=7697904' &
  dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=7805696' &
  dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=7805566' &
  dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=8091782' &
  dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=8065687' &
  dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=8169185' &
  dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=8170556' &
}

run
wait
<!-- gh-comment-id:2403419321 --> @sadok-f commented on GitHub (Oct 9, 2024): Hi @ebner I just released a fix for the issue you reported, thank you again. One thing regarding the `?` symbol: It needs to be encoded to be accepted in the image URL parameters `?` => `%3F` so your script should look like this: ``` #!/bin/bash function dl() { #sleep $((RANDOM % 50)) wget -O - -o /dev/null 'https://demo.flyimg.io/upload/w_300,q_90/'$1 | md5sum -b | cut -d' ' -f 1 } function run() { dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=8175306' & dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=7697905' & dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=7697901' & dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=7697904' & dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=7805696' & dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=7805566' & dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=8091782' & dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=8065687' & dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=8169185' & dl 'https://images.citybreakcdn.com/image.aspx%3FImageId=8170556' & } run wait ```
Author
Owner

@ebner commented on GitHub (Oct 10, 2024):

Hi @sadok-f

Perfect, thanks a lot for the quick fix! I can confirm that your fix solves the problem.

<!-- gh-comment-id:2404190851 --> @ebner commented on GitHub (Oct 10, 2024): Hi @sadok-f Perfect, thanks a lot for the quick fix! I can confirm that your fix solves the problem.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/flyimg#796
No description provided.