Wrong cache hit

Discussion in 'LiteSpeed Cache' started by IrPr, Jun 10, 2011.

  1. IrPr

    IrPr New Member

    Hi there,
    I'm seeing a very unexpected and unknown act by Litespeed cache feature

    Here is my cache Policy config:
    Code:
      <cache>
        <storage>
          <cacheStorePath>/dev/shm/lswscache</cacheStorePath>
          <maxCacheObjSize>102400</maxCacheObjSize>
        </storage>
        <cachePolicy>
          <enableCache>0</enableCache>
          <expireInSeconds></expireInSeconds>
          <qsCache>1</qsCache>
          <reqCookieCache>1</reqCookieCache>
          <respCookieCache>1</respCookieCache>
          <ignoreReqCacheCtrl>1</ignoreReqCacheCtrl>
          <ignoreRespCacheCtrl>1</ignoreRespCacheCtrl>
        </cachePolicy>
      </cache>
    
    here is my full htaccess with cache-control rewrite rule:
    Code:
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !\.(jpg|gif|jpeg|png|css|ico|js|swf|zip|rar|mp3|exe) [NC]
    RewriteRule . /index.php [L,E=Cache-Control:max-age=900]
    </IfModule>
    
    This is a big wordpress which I've enabled cache for its contents
    They're using SEO plugin and urls are in this format:

    /year/month/day/title/

    While most of links are cached and fetched properly sometimes a few urls are fetching wrong content instead
    for example /2011/06/09/title1 returns the content of another post, /2011/06/09/title2

    It returns wrong content for all requests for that url till pruning cache dir while the other cached contents are working properly

    I'm using Cache feature on many servers with the same rules for WP, all of them are working like a charm but this one

    Please note that its not occurring for WP only, there are other CMS such as PHPNuke which the same issue is happening with SEO rewrited urls, and the most unexpected thing is that they're fetching the contents from each other websites!
    The only matching thing between these URLs is that they're non-existing files SEO rewrite rules, but not the same cond/rules

    Seems there is a problem while saving the item to the cache to me

    PS: All 4.1x versions are affected

    Any idea is welcome

    Thanks
  2. mistwang

    mistwang LiteSpeed Staff

    does it happen randomly? or persistently?
    can it be reliably reproduced, like when it happened, /2011/06/09/title1 always return content of returns the content of /2011/06/09/title2? or, next time, just change to something else?

    We need to somehow reproduce it in our lab in order to get it fixed.
  3. IrPr

    IrPr New Member

    Dear George,

    Its happening very rarely and random, but when it occurs for one of cached contents it returns another cached object (just the same, not jumpy) until pruning cache directory

    I've experienced this issue on another busy server with big sites and lots of cached contents and very high hit rate

    Indeed its happening for the sites with the highest cached content and hit rate
    The CMS is not similar, the only resemblance is both websites are under heavy cache hit

    It seems to my customers that server/website is hacked, however it occurs very rarely

    Please let me know if any further information is needed
  4. mistwang

    mistwang LiteSpeed Staff

    I think it might be due to hash collisions. We will add more code to handle this situation.
    And we will improve the hash function for the page cache indexes to reduce collisions, will let you know when it is ready.
  5. mistwang

    mistwang LiteSpeed Staff

    Please download and try 4.1.2 build, just change version number in the download link to get it.
  6. IrPr

    IrPr New Member

    I've just installed 4.1.2 and see
    but now directory listing is broken even with Options Indexes in htaccess and httpd.conf

    would you please take a look into this also?
  7. mistwang

    mistwang LiteSpeed Staff

    Please check error.log and stderr.log. no change has been made related to directory listing in 4.1.2 .
  8. IrPr

    IrPr New Member

    Here is the problem

    2011-07-06 00:41:49.812 [INFO] [x.x.x.x.56857-0#APVH_w00t.com] Found symbolic link, or owner of symbolic link and link target does not match for path [/opt/lsws/share/autoindex/default.php], access denied.

    symlink is disabled through LSWS admin console and its impossible to turning that on due to security reasons which you know well
  9. mistwang

    mistwang LiteSpeed Staff

    Maybe you can use "If Owner match" instead of disable symlink completely.
  10. mistwang

    mistwang LiteSpeed Staff

    download 4.1.2 again, this version may work well with symlink off.

Share This Page