You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pagespeed.apache.org by GitBox <gi...@apache.org> on 2020/07/05 18:50:47 UTC

[GitHub] [incubator-pagespeed-ngx] jmarantz commented on issue #1686: Random 404s on re-written images (nginx with shared Redis cache)

jmarantz commented on issue #1686:
URL: https://github.com/apache/incubator-pagespeed-ngx/issues/1686#issuecomment-653924815


   I think the advice I gave earlier is still valid. Let me re-summarize.
   
      - Fixing problems by clearing the cache is not a long term solution.
      This should not be needed; PaegSpeed does not tend to have cache corruption
      issues. I realize clearing the cache appears to help but it's not the right
      solution and the 404s will keep coming back.
      - The source of the problem is, I'm pretty certain, that your
      mod_pagespeed instance is unable to fetch the resources that are being
      optimized. So what's happening is that there is an alternate fetch
      mechanism that is activated by InPlaceResourceOptimization, which gets you
      into the situation where a cache eviction causes a 404. I can explain in
      detail why but it's all there in
      https://github.com/apache/incubator-pagespeed-mod/issues/1145
   
   So, to resolve this problem:
   
      1. Disable InPlaceReosurceOptimization. If my theory is right, what you
      will see next is that no images, css, or JS files will be optimized at all.
      In your stats page you will see error messages in your log and
      failure-counts increasing in YOURSITE/pagespeed_admin/stats.
      2. Fix the problems with fetching. This is usually via configuring HTTPS
      certs properly within the pagsespeed configuration, or adding a few
      "pagespeed MapOriginDomain ..." directives.
      3. Observe that PageSpeed's resource fetches should now work, and things
      get optimized. There is no point in going further down this path until
      fetching works.
      4. Now you can re-enable InPlaceResouceOptimization if you like, but it
      might be safer to leave it off for a while.
   
   An alternative solution is to give up on PageSpeed's URL-rewriting
   features, and instead rely *solely* on InPlaceResourceOptimization. In this
   case I'd simplify your pagespeed configuration to only include:
   
   *pagespeed RewriteLevel OptimizeForBandwidth;*
   
   and nothing else. This is the easiest path, and does not rely on HTTPS
   fetching at all.
   
   Hope this helps,
   -Josh
   
   Hope this helps.
   -Josh
   
   On Sun, Jul 5, 2020 at 9:30 AM Andrew Borg <no...@github.com> wrote:
   
   > It's a docker system with a mounted stateful drive for cache. There are
   > multiple restarts (on every release) however the drive remains intact
   > between deployments.
   >
   > I dunno, it's just info I am giving you guys in case it helps with other
   > similar issues. I noticed that dropping the pagespeed cache folder
   > completely and re-creating it fixed the issue. The re-written images were
   > available immediately from the memcached server. I set the server to allow
   > a max size of 3mb i think, nothing is really bigger than that.
   >
   > Thanks :)
   >
   >
   >
   > On Sun, 5 Jul 2020 at 12:15, Lofesa <no...@github.com> wrote:
   >
   > > Have you done a system restart?
   > > Some systems when restarted re-create folders with determined user and
   > > permisions, and may be these user/permision don´t permit write to the
   > user
   > > that runs the apache/nginx processes.
   > > For example, in Centos distro you have the /etc/tempfiles.d/ directory
   > > that may contain config files with lines like:
   > > D /var/run/cache/nginx/ 0755 nginx nginx -
   > > This line creates a directory (D) in this path with this permissions and
   > > user/group owner.
   > > This directory is created each restart if don´t exists.
   > >
   > > In other hand, memcached don´t store all pagespeed cache objects. Their
   > > default config, stores only objects until 1Mb. This size is configurable
   > > but allways fixed. If you configure it to store objects until 5Mb, these
   > > that are biger need the file cache and if these file cache don´t exists
   > or
   > > is unwritable.....
   > > Redis can store object of any size.
   > >
   > > —
   > > You are receiving this because you were mentioned.
   > > Reply to this email directly, view it on GitHub
   > > <
   > https://github.com/apache/incubator-pagespeed-ngx/issues/1686#issuecomment-653869325
   > >,
   > > or unsubscribe
   > > <
   > https://github.com/notifications/unsubscribe-auth/ABNJRH6MOWKN4XKS4ZWDKLTR2BHFBANCNFSM4MTB4TGA
   > >
   > > .
   > >
   >
   > —
   > You are receiving this because you were mentioned.
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/incubator-pagespeed-ngx/issues/1686#issuecomment-653889352>,
   > or unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/AAO2IPLLTPZCM7QEI3EQKWDR2B57TANCNFSM4MTB4TGA>
   > .
   >
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org