[GH-ISSUE #476] are there any way to free RAM #779

Closed
opened 2026-03-15 15:24:38 +03:00 by kerem · 27 comments
Owner

Originally created by @francescor on GitHub (Jul 7, 2024).
Original GitHub issue: https://github.com/flyimg/flyimg/issues/476

Originally assigned to: @sadok-f on GitHub.

we use it in docker swarm (6 replicas), and see containers start with 38M RAM, ...while after some time RAM easily reach the limit we set to 3G.

We have the feeling we are wasting RAM.

any suggestion on how to be sure all that allocated RAM is necessary?

Originally created by @francescor on GitHub (Jul 7, 2024). Original GitHub issue: https://github.com/flyimg/flyimg/issues/476 Originally assigned to: @sadok-f on GitHub. we use it in docker swarm (6 replicas), and see containers start with 38M RAM, ...while after some time RAM easily reach the limit we set to 3G. We have the feeling we are wasting RAM. any suggestion on how to be sure all that allocated RAM is necessary?
kerem 2026-03-15 15:24:38 +03:00
Author
Owner

@sadok-f commented on GitHub (Jul 7, 2024):

Thank you @francescor for opening this issue.
could you please specify more details about your environment (if possible a copy for your docker swarm file)
after how many days/weeks Flyimg's containers reach 3Gb? (we're running the demo page for over 2 weeks and the MEM Usage is ~400 Mb).
which Flyimg's version are you using?
how is the overall traffic you're receiving for the Flyimg instances?

Thanks

<!-- gh-comment-id:2212407559 --> @sadok-f commented on GitHub (Jul 7, 2024): Thank you @francescor for opening this issue. could you please specify more details about your environment (if possible a copy for your docker swarm file) after how many days/weeks Flyimg's containers reach 3Gb? (we're running the demo page for over 2 weeks and the MEM Usage is ~400 Mb). which Flyimg's version are you using? how is the overall traffic you're receiving for the Flyimg instances? Thanks
Author
Owner

@francescor commented on GitHub (Aug 1, 2024):

sure, here is the stack file

$ cat flyimg.yml

version: "3.8"


x-deploy: &deploy-snippet
      endpoint_mode: dnsrr
      replicas: 2
      update_config:
        parallelism: 2
        order: start-first
        delay: 10s
        failure_action: rollback
        monitor: 10s
      rollback_config:
        parallelism: 1
        delay: 10s
        failure_action: pause         # default: pause or continue
        monitor: 10s                  # default: 5s
        order: start-first
      restart_policy:
        condition: any
        delay: 15s                    # default: 5s, between attempts
        max_attempts: 50
        window: 20s                   # time to decide if the restart has been sucessfull
      resources:
        reservations:
          memory: 2G
          cpus: '0.5'
        limits:
          cpus: '1'
          memory: 3G

networks:
  traefik2:
    external: true
    name: traefik2

configs:
  parameters.yml:
    name: flyimg-v13.yml
    file: ./config/flyimg.yml

services:
  phppm:
    image: flyimg/flyimg-build:1.1.56
    networks:
      - traefik2
    healthcheck:
      test: ["CMD", "wget", "--spider", "http://localhost/upload/w_10/https://s3.eu-west-1.amazonaws.com/mydomain/flyimg/flyimg-healthcheck.png"]
    configs:
      - source: parameters.yml
        target: /var/www/html/config/parameters.yml
    volumes:
      - /srv/data/flyimg/tmp:/var/www/html/var/tmp
    environment:
      MAGICK_TMPDIR: /var/www/html/var/tmp      #mapped to filesystem
      MAGICK_THREAD_LIMIT: 8
      # Set maximum amount of memory map in bytes to allocate for the pixel cache. When this limit is exceeded, the image pixels are cached to disk (see MAGICK_DISK_LIMIT).
      MAGICK_MAP_LIMIT: '512MB'
      # Set maximum amount of memory in megabytes to allocate for the pixel cache from the heap. When this limit is exceeded, the image pixels are cached to memory-mapped disk (see MAGICK_MAP_LIMIT).
      MAGICK_MEMORY_LIMIT: '1024MB'
      MAGICK_WIDTH_LIMIT: '100MP'
      MAGICK_HEIGHT_LIMIT: '100MP'
    deploy:
      <<: *deploy-snippet
      replicas: 6
      labels:
        traefik.enable: 'true'
        traefik.docker.network: "traefik2"
        traefik.http.services.flyimg.loadbalancer.server.port: 80
          # da testare, gia' messo in docker health
        traefik.http.services.flyimg.loadbalancer.healthcheck.path: /upload/w_10/https://s3.eu-west-1.amazonaws.com/static.opencityitalia.it/flyimg/flyimg-healthcheck.png
        traefik.http.routers.flyimg-https.rule: 'Method(`GET`, `HEAD`, `OPTIONS`) && Host(`myflyimg.mydomain.it`)'
        traefik.http.routers.flyimg-https.tls: 'true'
        traefik.http.routers.flyimg-https.tls.certresolver: 'mydnschallenge'
        traefik.http.routers.flyimg-https.middlewares: 'goodheaders, cors-flyimg'

        traefik.http.middlewares.cors-flyimg.headers.accesscontrolallowcredentials: 'true'
        traefik.http.middlewares.cors-flyimg.headers.accesscontrolallowheaders: 'Authorization,Origin,Content-Type,Accept,access-control-allow-headers,access-control-allow-methods,access-control-allow-credentials,Referer'
        traefik.http.middlewares.cors-flyimg.headers.accesscontrolallowmethods: 'GET,POST,HEAD,PUT,DELETE,PATCH,OPTIONS'
        traefik.http.middlewares.cors-flyimg.headers.accesscontrolalloworiginlist: '*'
        traefik.http.middlewares.cors-flyimg.headers.accesscontrolmaxage: 100
        traefik.http.middlewares.cors-flyimg.headers.addvaryheader: 'true'
<!-- gh-comment-id:2262065577 --> @francescor commented on GitHub (Aug 1, 2024): sure, here is the stack file ``` $ cat flyimg.yml version: "3.8" x-deploy: &deploy-snippet endpoint_mode: dnsrr replicas: 2 update_config: parallelism: 2 order: start-first delay: 10s failure_action: rollback monitor: 10s rollback_config: parallelism: 1 delay: 10s failure_action: pause # default: pause or continue monitor: 10s # default: 5s order: start-first restart_policy: condition: any delay: 15s # default: 5s, between attempts max_attempts: 50 window: 20s # time to decide if the restart has been sucessfull resources: reservations: memory: 2G cpus: '0.5' limits: cpus: '1' memory: 3G networks: traefik2: external: true name: traefik2 configs: parameters.yml: name: flyimg-v13.yml file: ./config/flyimg.yml services: phppm: image: flyimg/flyimg-build:1.1.56 networks: - traefik2 healthcheck: test: ["CMD", "wget", "--spider", "http://localhost/upload/w_10/https://s3.eu-west-1.amazonaws.com/mydomain/flyimg/flyimg-healthcheck.png"] configs: - source: parameters.yml target: /var/www/html/config/parameters.yml volumes: - /srv/data/flyimg/tmp:/var/www/html/var/tmp environment: MAGICK_TMPDIR: /var/www/html/var/tmp #mapped to filesystem MAGICK_THREAD_LIMIT: 8 # Set maximum amount of memory map in bytes to allocate for the pixel cache. When this limit is exceeded, the image pixels are cached to disk (see MAGICK_DISK_LIMIT). MAGICK_MAP_LIMIT: '512MB' # Set maximum amount of memory in megabytes to allocate for the pixel cache from the heap. When this limit is exceeded, the image pixels are cached to memory-mapped disk (see MAGICK_MAP_LIMIT). MAGICK_MEMORY_LIMIT: '1024MB' MAGICK_WIDTH_LIMIT: '100MP' MAGICK_HEIGHT_LIMIT: '100MP' deploy: <<: *deploy-snippet replicas: 6 labels: traefik.enable: 'true' traefik.docker.network: "traefik2" traefik.http.services.flyimg.loadbalancer.server.port: 80 # da testare, gia' messo in docker health traefik.http.services.flyimg.loadbalancer.healthcheck.path: /upload/w_10/https://s3.eu-west-1.amazonaws.com/static.opencityitalia.it/flyimg/flyimg-healthcheck.png traefik.http.routers.flyimg-https.rule: 'Method(`GET`, `HEAD`, `OPTIONS`) && Host(`myflyimg.mydomain.it`)' traefik.http.routers.flyimg-https.tls: 'true' traefik.http.routers.flyimg-https.tls.certresolver: 'mydnschallenge' traefik.http.routers.flyimg-https.middlewares: 'goodheaders, cors-flyimg' traefik.http.middlewares.cors-flyimg.headers.accesscontrolallowcredentials: 'true' traefik.http.middlewares.cors-flyimg.headers.accesscontrolallowheaders: 'Authorization,Origin,Content-Type,Accept,access-control-allow-headers,access-control-allow-methods,access-control-allow-credentials,Referer' traefik.http.middlewares.cors-flyimg.headers.accesscontrolallowmethods: 'GET,POST,HEAD,PUT,DELETE,PATCH,OPTIONS' traefik.http.middlewares.cors-flyimg.headers.accesscontrolalloworiginlist: '*' traefik.http.middlewares.cors-flyimg.headers.accesscontrolmaxage: 100 traefik.http.middlewares.cors-flyimg.headers.addvaryheader: 'true' ```
Author
Owner

@francescor commented on GitHub (Aug 1, 2024):

and the cited config file


$ cat config/flyimg.yml


application_name: myflyimg.mydomain.it

#debug
debug: true

#Number of days for header cache expires `max_age`
header_cache_days: 365 

#options separator
options_separator: ","

#Security: Signature generation
# security key
security_key: ""
# secret Initialization vector(IV)
security_iv: ""

# restrict domains, false by default
restricted_domains: false

# Default storage system is local, to use use AWS S3, change this param to s3
storage_system: local

# Number of threads for Imagemagick to use
thread: 5 

#Extra options for the header sent to source image server, as some servers requires the User-Agent.
header_extra_options: 'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; rv:2.2) Gecko/20110201'

#List of request header to forward to source image server (example Authorization)
forward_request_headers: [Authorization]

Keys used in url to match options. Ex: q_80,w_200,h_100
options_keys:
  moz: mozjpeg
  q: quality
  o: output
  unsh: unsharp
  sh: sharpen
  blr: blur
  fc: face-crop
  fcp: face-crop-position
  fb: face-blur
  w: width
  h: height
  c: crop
  bg: background
  st: strip
  rz: resize
  g: gravity
  f: filter
  r: rotate
  sc: scale
  sf: sampling-factor
  rf: refresh
  smc: smart-crop
  ett: extent
  par: preserve-aspect-ratio
  pns: preserve-natural-size
  webpl: webp-lossless
  gf: gif-frame
  e: extract
  p1x: extract-top-x
  p1y: extract-top-y
  p2x: extract-bottom-x
  p2y: extract-bottom-y
  pg: page_number
  tm: time
  clsp: colorspace
  mnchr: monochrome

#Default options values
default_options:
  mozjpeg: 1
  quality: 90
  output: auto
  unsharp: null
  sharpen: null
  blur: null
  face-crop: 0
  face-crop-position: 0
  face-blur: 0
  width: null
  height: null
  crop: null
  background: null
  strip: 1
  resize: null
  gravity: Center
  filter: Lanczos
  rotate: null
  scale: null
  sampling-factor: 1x1
  refresh: false
  smart-crop: false
  extent: null
  preserve-aspect-ratio: 1
  preserve-natural-size: 1
  webp-lossless: 0
  gif-frame: 0
  extract: null
  extract-top-x: null
  extract-top-y: null
  extract-bottom-x: null
  extract-bottom-y: null
  page_number: 1
  time: '00:00:01'
  colorspace: 'sRGB'
  monochrome: null
<!-- gh-comment-id:2262071726 --> @francescor commented on GitHub (Aug 1, 2024): and the cited config file ``` $ cat config/flyimg.yml application_name: myflyimg.mydomain.it #debug debug: true #Number of days for header cache expires `max_age` header_cache_days: 365 #options separator options_separator: "," #Security: Signature generation # security key security_key: "" # secret Initialization vector(IV) security_iv: "" # restrict domains, false by default restricted_domains: false # Default storage system is local, to use use AWS S3, change this param to s3 storage_system: local # Number of threads for Imagemagick to use thread: 5 #Extra options for the header sent to source image server, as some servers requires the User-Agent. header_extra_options: 'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; rv:2.2) Gecko/20110201' #List of request header to forward to source image server (example Authorization) forward_request_headers: [Authorization] Keys used in url to match options. Ex: q_80,w_200,h_100 options_keys: moz: mozjpeg q: quality o: output unsh: unsharp sh: sharpen blr: blur fc: face-crop fcp: face-crop-position fb: face-blur w: width h: height c: crop bg: background st: strip rz: resize g: gravity f: filter r: rotate sc: scale sf: sampling-factor rf: refresh smc: smart-crop ett: extent par: preserve-aspect-ratio pns: preserve-natural-size webpl: webp-lossless gf: gif-frame e: extract p1x: extract-top-x p1y: extract-top-y p2x: extract-bottom-x p2y: extract-bottom-y pg: page_number tm: time clsp: colorspace mnchr: monochrome #Default options values default_options: mozjpeg: 1 quality: 90 output: auto unsharp: null sharpen: null blur: null face-crop: 0 face-crop-position: 0 face-blur: 0 width: null height: null crop: null background: null strip: 1 resize: null gravity: Center filter: Lanczos rotate: null scale: null sampling-factor: 1x1 refresh: false smart-crop: false extent: null preserve-aspect-ratio: 1 preserve-natural-size: 1 webp-lossless: 0 gif-frame: 0 extract: null extract-top-x: null extract-top-y: null extract-bottom-x: null extract-bottom-y: null page_number: 1 time: '00:00:01' colorspace: 'sRGB' monochrome: null ```
Author
Owner

@francescor commented on GitHub (Aug 1, 2024):

last 48 hours of RAM usage
image

<!-- gh-comment-id:2262077925 --> @francescor commented on GitHub (Aug 1, 2024): last 48 hours of RAM usage ![image](https://github.com/user-attachments/assets/4274def4-0add-442c-8756-48831872d988)
Author
Owner

@francescor commented on GitHub (Aug 1, 2024):

last 12 hrs here in cpu
image

<!-- gh-comment-id:2262092499 --> @francescor commented on GitHub (Aug 1, 2024): last 12 hrs here in cpu ![image](https://github.com/user-attachments/assets/5415369c-8e54-42f5-b301-356245f4dc5f)
Author
Owner

@francescor commented on GitHub (Aug 1, 2024):

the RAM now is lower, indeed (users are in vacation), let me find some busy day with RAM spikes

<!-- gh-comment-id:2262099942 --> @francescor commented on GitHub (Aug 1, 2024): the RAM now is lower, indeed (users are in vacation), let me find some busy day with RAM spikes
Author
Owner

@francescor commented on GitHub (Aug 1, 2024):

so, issues are raised by alarm from cadadviser on "memory", but I see several memory indicators:

image

image

image

image

image

so we probably have to ignore some of these indicators?

<!-- gh-comment-id:2262141262 --> @francescor commented on GitHub (Aug 1, 2024): so, issues are raised by alarm from cadadviser on "memory", but I see several memory indicators: ![image](https://github.com/user-attachments/assets/a6abfff4-9066-40a6-8964-da86ae16e90c) ![image](https://github.com/user-attachments/assets/7ea6472c-1d76-495e-8c24-e37876b43c17) ![image](https://github.com/user-attachments/assets/f56978f5-ea10-41e4-b4ae-2097da46b9f2) ![image](https://github.com/user-attachments/assets/5333eb27-5a56-4306-9562-60f7737462aa) ![image](https://github.com/user-attachments/assets/93242aaa-45ad-48cb-8757-897a37d1bc3e) so we probably have to ignore some of these indicators?
Author
Owner

@francescor commented on GitHub (Aug 1, 2024):

in details: memory_working_set_bytes (which we read is the one watched by OOM killer) is this one

image

<!-- gh-comment-id:2262152554 --> @francescor commented on GitHub (Aug 1, 2024): in details: `memory_working_set_bytes` (which we read is the one watched by OOM killer) is this one ![image](https://github.com/user-attachments/assets/cc38a433-6eeb-44f8-add7-308d9ce4437c)
Author
Owner

@francescor commented on GitHub (Aug 11, 2024):

@sadok-f any advice you can give us? even some links will be fine, then we'll dig and post here our feeds

<!-- gh-comment-id:2282695205 --> @francescor commented on GitHub (Aug 11, 2024): @sadok-f any advice you can give us? even some links will be fine, then we'll dig and post here our feeds
Author
Owner

@francescor commented on GitHub (Aug 11, 2024):

for exampla now the alarm for prometheus query:

(container_spec_memory_limit_bytes > 0) AND (container_memory_working_set_bytes / container_spec_memory_limit_bytes * 100) > 90

is on for a flyimg container: it's docker stats return

CONTAINER ID   NAME                                       CPU %     MEM USAGE / LIMIT   MEM %     NET I/O           BLOCK I/O        PIDS
ee3725a3ce84   flyimg_phppm.6.7zhfsbvo171md38jw955yihzz   0.01%     2.736GiB / 3GiB     91.19%    1.81GB / 31.3GB   4.8GB / 4.81GB   12

That container started 2 weeks ago

<!-- gh-comment-id:2282701227 --> @francescor commented on GitHub (Aug 11, 2024): for exampla now the alarm for prometheus query: ``` (container_spec_memory_limit_bytes > 0) AND (container_memory_working_set_bytes / container_spec_memory_limit_bytes * 100) > 90 ``` is on for a flyimg container: it's docker stats return ``` CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS ee3725a3ce84 flyimg_phppm.6.7zhfsbvo171md38jw955yihzz 0.01% 2.736GiB / 3GiB 91.19% 1.81GB / 31.3GB 4.8GB / 4.81GB 12 ``` That container started 2 weeks ago
Author
Owner

@sadok-f commented on GitHub (Aug 12, 2024):

Sorry @francescor for not answering you, I'm currently on vacation until the end of August.
As soon as I get back I will check it out.
Thank you.

<!-- gh-comment-id:2283212485 --> @sadok-f commented on GitHub (Aug 12, 2024): Sorry @francescor for not answering you, I'm currently on vacation until the end of August. As soon as I get back I will check it out. Thank you.
Author
Owner

@sadok-f commented on GitHub (Aug 29, 2024):

@francescor just fyi, we're able to reproduce the issue and we're investigating it.

<!-- gh-comment-id:2318246396 --> @sadok-f commented on GitHub (Aug 29, 2024): @francescor just fyi, we're able to reproduce the issue and we're investigating it.
Author
Owner

@sadok-f commented on GitHub (Aug 30, 2024):

Hi @francescor,
I just released a new version flyimg/flyimg:1.4.7 it contains a couple of enhancements and sets the php-fpm settings pm.max_requests = 50
this should avoid memory leaks by restarting the PHP-FPM worker process after serving a certain number of requests (50)

Also I noticed you're using an old Flyimg version image: flyimg/flyimg-build:1.1.56 would be great if you could upgrade to the latest version and test your setup, probably you need to check config/parameters.yml file as in the recent releases we introduced a couple of new options and changes.

I'm looking forward to hearing back from you.

<!-- gh-comment-id:2320640588 --> @sadok-f commented on GitHub (Aug 30, 2024): Hi @francescor, I just released a new version `flyimg/flyimg:1.4.7` it contains a couple of enhancements and sets the php-fpm settings `pm.max_requests = 50` this should avoid memory leaks by restarting the PHP-FPM worker process after serving a certain number of requests (50) Also I noticed you're using an old Flyimg version `image: flyimg/flyimg-build:1.1.56` would be great if you could upgrade to the latest version and test your setup, probably you need to check `config/parameters.yml` file as in the recent releases we introduced a couple of new options and changes. I'm looking forward to hearing back from you.
Author
Owner

@francescor commented on GitHub (Sep 5, 2024):

I've just tried but had issue with the main page

image

Then this image https://s3-eu-west-1.amazonaws.com/static.opencity.opencontent.it/var/masullas/storage/images/3330-2-ita-IT/Homepage_header_logo.png was also rendered weird in our instance

image

while in your demo is perfect https://demo.flyimg.io/upload/o_auto,w_2500,h_2500/https%3A%2F%2Fs3-eu-west-1.amazonaws.com%2Fstatic.opencity.opencontent.it%2Fvar%2Fmasullas%2Fstorage%2Fimages%2F3330-2-ita-IT%2FHomepage_header_logo.png

I guess it is 'cause of some parameters we've added previously; I applied the changes for the new version

diff parameters_old.yml parameters_new.yml
<   pg: page_number
---
>   pdfp: pdf-page-number
120c120
<   page_number: 1
---
>   pdf-page-number: 1
123a124,128
> 
> # when set to true the generated image will be deleted from the cache in web/upload and served directly in the response
> # Defaults to: false
> disable_cache: false

e.g.

we also had several `Message: Command failed.`  for `convert` and `magick` I can post if it can help
flyimg_phppm.1.ekxnty905ra5@boat-worker-4c8a    | Message: Command failed.
flyimg_phppm.1.ekxnty905ra5@boat-worker-4c8a    | The exit code: Unsupported Targa colormap format
flyimg_phppm.1.ekxnty905ra5@boat-worker-4c8a    | The last line of output: /usr/local/bin/magick /var/www/html/var/tmp/original-3b23ad3d43bfeadb693d51b401076979 -thumbnail '400'x'400''>' -colorspace 'sRGB'  -filter 'Lanczos' -strip TGA:- | '/opt/mozjpeg/cjpeg' -quality '90' -outfile '/var/www/html/var/tmp/2c9cc62e7e9e667023e4f079e5156211.jpg' -targa 
flyimg_phppm.1.ekxnty905ra5@boat-worker-4c8a    | File: /var/www/html/src/Core/Processor/Processor.php
flyimg_phppm.1.ekxnty905ra5@boat-worker-4c8a    | Line: 54
<!-- gh-comment-id:2331002773 --> @francescor commented on GitHub (Sep 5, 2024): I've just tried but had issue with the main page ![image](https://github.com/user-attachments/assets/0225c64d-14e3-439a-8fb9-48420eb84c16) Then this image https://s3-eu-west-1.amazonaws.com/static.opencity.opencontent.it/var/masullas/storage/images/3330-2-ita-IT/Homepage_header_logo.png was also rendered weird in our instance ![image](https://github.com/user-attachments/assets/103ba969-a30e-4468-a73e-2cabb2554b88) while in your demo is perfect https://demo.flyimg.io/upload/o_auto,w_2500,h_2500/https%3A%2F%2Fs3-eu-west-1.amazonaws.com%2Fstatic.opencity.opencontent.it%2Fvar%2Fmasullas%2Fstorage%2Fimages%2F3330-2-ita-IT%2FHomepage_header_logo.png I guess it is 'cause of some parameters we've added previously; I applied the changes for the new version ``` diff parameters_old.yml parameters_new.yml < pg: page_number --- > pdfp: pdf-page-number 120c120 < page_number: 1 --- > pdf-page-number: 1 123a124,128 > > # when set to true the generated image will be deleted from the cache in web/upload and served directly in the response > # Defaults to: false > disable_cache: false ``` e.g. ``` we also had several `Message: Command failed.` for `convert` and `magick` I can post if it can help flyimg_phppm.1.ekxnty905ra5@boat-worker-4c8a | Message: Command failed. flyimg_phppm.1.ekxnty905ra5@boat-worker-4c8a | The exit code: Unsupported Targa colormap format flyimg_phppm.1.ekxnty905ra5@boat-worker-4c8a | The last line of output: /usr/local/bin/magick /var/www/html/var/tmp/original-3b23ad3d43bfeadb693d51b401076979 -thumbnail '400'x'400''>' -colorspace 'sRGB' -filter 'Lanczos' -strip TGA:- | '/opt/mozjpeg/cjpeg' -quality '90' -outfile '/var/www/html/var/tmp/2c9cc62e7e9e667023e4f079e5156211.jpg' -targa flyimg_phppm.1.ekxnty905ra5@boat-worker-4c8a | File: /var/www/html/src/Core/Processor/Processor.php flyimg_phppm.1.ekxnty905ra5@boat-worker-4c8a | Line: 54 ```
Author
Owner

@francescor commented on GitHub (Sep 5, 2024):

I did not clean the cache (or waited the default cron), but we are in docker swarm, so the deploy imply brand new container (with empty storage)

<!-- gh-comment-id:2331004516 --> @francescor commented on GitHub (Sep 5, 2024): I did not clean the cache (or waited the default cron), but we are in docker swarm, so the deploy imply brand new container (with empty storage)
Author
Owner

@sadok-f commented on GitHub (Sep 5, 2024):

@francescor it seems the CSS is not loaded properly, is Flyimg exposed externally? can you post the link here?

we also had several Message: Command failed. for convert and magick I can post if it can help

can you post here the image URL that caused this error?

Thanks!

<!-- gh-comment-id:2331287560 --> @sadok-f commented on GitHub (Sep 5, 2024): @francescor it seems the CSS is not loaded properly, is Flyimg exposed externally? can you post the link here? > we also had several `Message: Command failed.` for `convert` and `magick` I can post if it can help can you post here the image URL that caused this error? Thanks!
Author
Owner

@francescor commented on GitHub (Sep 7, 2024):

it was in production, but I had to revert to old version 'cause of those issues.
let me try to replicate to a dev version and give you the link

<!-- gh-comment-id:2335048088 --> @francescor commented on GitHub (Sep 7, 2024): it was in production, but I had to revert to old version 'cause of those issues. let me try to replicate to a dev version and give you the link
Author
Owner

@francescor commented on GitHub (Sep 7, 2024):

the CSS issue is solved (it was due to a custom security header)

<!-- gh-comment-id:2335283668 --> @francescor commented on GitHub (Sep 7, 2024): the CSS issue is solved (it was due to a custom security header)
Author
Owner
<!-- gh-comment-id:2335294598 --> @francescor commented on GitHub (Sep 7, 2024): We still have an issue with images like this one https://s3-eu-west-1.amazonaws.com/static.opencity.opencontent.it/var/masullas/storage/images/3330-2-ita-IT/Homepage_header_logo.png Here a testing stack https://flyimg-test.boat.opencontent.io/upload/o_auto,w_2500,h_2500/https%3A%2F%2Fs3-eu-west-1.amazonaws.com%2Fstatic.opencity.opencontent.it%2Fvar%2Fmasullas%2Fstorage%2Fimages%2F3330-2-ita-IT%2FHomepage_header_logo.png
Author
Owner

@francescor commented on GitHub (Sep 7, 2024):

Uh, this is interesting, the same image issue is in your demo.

https://demo.flyimg.io/upload/o_auto,w_2500,h_2500/https%3A%2F%2Fs3-eu-west-1.amazonaws.com%2Fstatic.opencity.opencontent.it%2Fvar%2Fmasullas%2Fstorage%2Fimages%2F3330-2-ita-IT%2FHomepage_header_logo.png

where when I use Firefox with my ordinary setting (not in private/anonymous mode) the image is rendered bad

image

and the console says

Content-Security-Policy: The page’s settings blocked an inline script (script-src-elem) from being executed because it violates the following directive: “script-src 'self'”

while if I use Firefox in private/anonymous mode, of Chromium, I have no problem and the image is rendered correctly (plus I do not get that console Content-Security-Policy errror.

image

<!-- gh-comment-id:2335378974 --> @francescor commented on GitHub (Sep 7, 2024): Uh, this is interesting, the same image issue is in your demo. https://demo.flyimg.io/upload/o_auto,w_2500,h_2500/https%3A%2F%2Fs3-eu-west-1.amazonaws.com%2Fstatic.opencity.opencontent.it%2Fvar%2Fmasullas%2Fstorage%2Fimages%2F3330-2-ita-IT%2FHomepage_header_logo.png where when I use Firefox with my ordinary setting (_not_ in private/anonymous mode) the image is rendered bad ![image](https://github.com/user-attachments/assets/e78235ee-322e-4075-8dff-80fa42b5fd4a) and the console says ``` Content-Security-Policy: The page’s settings blocked an inline script (script-src-elem) from being executed because it violates the following directive: “script-src 'self'” ``` while if I use Firefox in private/anonymous mode, of Chromium, I have no problem and the image is rendered correctly (plus I do not get that console Content-Security-Policy errror. ![image](https://github.com/user-attachments/assets/759fe6c3-5ce6-4ad8-aced-742df7d75bd4)
Author
Owner

@francescor commented on GitHub (Sep 7, 2024):

mah, I don't get it: now in my firefox I have two tab with exactly the same above link
and in one tab the image works (even with the CSP error, so that error is probably un-related), on the other one does not :(

image

I notice that, when the image is rendered correctly by Firefox, if I save it the extension is .avif

$ file good_image.avif 
good_image.avif: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, progressive, precision 8, 400x400, components 3

while when it is not, the extension in .jpg

$ file bad_image.jpg 
bad_image.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, progressive, precision 8, 400x400, components 3
<!-- gh-comment-id:2335464687 --> @francescor commented on GitHub (Sep 7, 2024): mah, I don't get it: now in my firefox I have two tab with exactly the same [above]( https://demo.flyimg.io/upload/o_auto,w_2500,h_2500/https%3A%2F%2Fs3-eu-west-1.amazonaws.com%2Fstatic.opencity.opencontent.it%2Fvar%2Fmasullas%2Fstorage%2Fimages%2F3330-2-ita-IT%2FHomepage_header_logo.png) link and in one tab the image works (even with the CSP error, so that error is probably un-related), on the other one does not :( ![image](https://github.com/user-attachments/assets/dcafe567-b4a5-44ef-9104-cb1df2feb7fc) I notice that, when the image is rendered correctly by Firefox, if I save it the extension is `.avif` ``` $ file good_image.avif good_image.avif: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, progressive, precision 8, 400x400, components 3 ``` while when it is not, the extension in `.jpg` ``` $ file bad_image.jpg bad_image.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, progressive, precision 8, 400x400, components 3 ```
Author
Owner

@francescor commented on GitHub (Sep 7, 2024):

uh, with our current old version of flyimg (1.1.56), that image is rendered correctly, and when saved is a .webp

$ file good_image_old_version.webp
good_image_old_version.webp: RIFF (little-endian) data, Web/P image

So I guess I can solve just by disabling avif and enabling webp, am I correct?

<!-- gh-comment-id:2335572151 --> @francescor commented on GitHub (Sep 7, 2024): uh, with our current old version of flyimg (1.1.56), that image is rendered correctly, and when saved is a `.webp` ``` $ file good_image_old_version.webp good_image_old_version.webp: RIFF (little-endian) data, Web/P image ``` So I guess I can solve just by disabling `avif` and enabling `webp`, am I correct?
Author
Owner

@francescor commented on GitHub (Sep 8, 2024):

so, it is just a matter of that "auto", since

In parameters we have

default_options:
  output: auto

So, we've fixed this image rendering issue with (updated)

enable_webp: true  

so enable_webp is apparently not true by default https://flyimg.io/configuration/#enable_webp

sorry for writing the above here and not in a new issue

<!-- gh-comment-id:2336615923 --> @francescor commented on GitHub (Sep 8, 2024): so, it is just a matter of that "auto", since * this works (avif) https://flyimg-test.boat.opencontent.io/upload/o_avif,w_2500,h_2500/https%3A%2F%2Fs3-eu-west-1.amazonaws.com%2Fstatic.opencity.opencontent.it%2Fvar%2Fmasullas%2Fstorage%2Fimages%2F3330-2-ita-IT%2FHomepage_header_logo.png * this works (webp) https://flyimg-test.boat.opencontent.io/upload/o_webp,w_2500,h_2500/https%3A%2F%2Fs3-eu-west-1.amazonaws.com%2Fstatic.opencity.opencontent.it%2Fvar%2Fmasullas%2Fstorage%2Fimages%2F3330-2-ita-IT%2FHomepage_header_logo.png * while with auto https://flyimg-test.boat.opencontent.io/upload/o_auto,w_2500,h_2500/https%3A%2F%2Fs3-eu-west-1.amazonaws.com%2Fstatic.opencity.opencontent.it%2Fvar%2Fmasullas%2Fstorage%2Fimages%2F3330-2-ita-IT%2FHomepage_header_logo.png * Firefox 129.0.2 64-bit while _not_ anonymous mode, I get a jpg which render the image not well * Firefox in anonymous mode & Chomium works (most of the time) and render an avif, but sometimes I've got a wrong jpg, too In parameters we have ``` default_options: output: auto ``` So, we've fixed this image rendering issue with (updated) ``` enable_webp: true ``` so `enable_webp` is apparently **not true by default** https://flyimg.io/configuration/#enable_webp sorry for writing the above here and not in a new issue
Author
Owner

@francescor commented on GitHub (Sep 9, 2024):

we are ready to deploy today's latest image in production, with S3 (too!), so I am confident the RAM will become less an issue: we'll deploy in the next 24hrs, and will let you know asap

<!-- gh-comment-id:2338961449 --> @francescor commented on GitHub (Sep 9, 2024): we are ready to deploy today's latest image in production, with S3 (too!), so I am confident the RAM will become less an issue: we'll deploy in the next 24hrs, and will let you know asap
Author
Owner

@github-actions[bot] commented on GitHub (Oct 10, 2024):

This issue is stale (30 days with no activity)

<!-- gh-comment-id:2403821744 --> @github-actions[bot] commented on GitHub (Oct 10, 2024): This issue is stale (30 days with no activity)
Author
Owner

@francescor commented on GitHub (Oct 18, 2024):

We've been in production with updated release, and it's much better.

It was

image

and now only one container was weird, but maybe an outlier

image

so this issue can be closed, thank you!

<!-- gh-comment-id:2422382999 --> @francescor commented on GitHub (Oct 18, 2024): We've been in production with updated release, and it's much better. It was ![image](https://github.com/user-attachments/assets/9e7ed28a-59ac-4b52-8db1-072e8b1551e6) and now only one container was weird, but maybe an outlier ![image](https://github.com/user-attachments/assets/2d8896d7-6c22-4f11-9afa-dc20637ecfcf) so this issue can be closed, thank you!
Author
Owner

@francescor commented on GitHub (Oct 23, 2024):

We can confirm now the issue is definitively solved

Here the last 10 days with flyimg/flyimg:1.4.14

image

thank you!

<!-- gh-comment-id:2430757425 --> @francescor commented on GitHub (Oct 23, 2024): We can confirm now the issue is definitively solved Here the last 10 days with flyimg/flyimg:1.4.14 ![image](https://github.com/user-attachments/assets/d26f255a-46b8-43f0-be2e-0cf952eed91b) thank you!
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#779
No description provided.