• Resolved ImageKristián Filo

    (@kristianfilo)


    I have a problem with LSCache running on OpenLiteSpeed server, that my enqueued main theme JS file (and probably other JS assets as well) are randomly not loading on some cached pages, causing various problems (lazy loading not working on those pages (gray placeholders), scripts not running at all, etc.).

    I have confirmed this by doing a simple console.log() on document ready event, which gets triggered on (almost) every page, instead the broken ones that don’t have JS loaded correctly.

    Here’s my JS settings in Page Optimization:

    • JS minify: ON
    • JS combine: OFF
    • JS combine external and inline: ON (but this shouldn’t have any effect since combine is disabled)
    • JS defered: OFF

    CSS seems to be loading fine everywhere, because I’m not noticing any layout/design problems. I am loading my JS assets like this:

    wp_enqueue_script( 'app-js', get_stylesheet_directory_uri() . '/assets/js/app.js', array('jquery'), TEME_VERSION, true );

    I can also see something is wrong when checking the Source tab in browser DevTools: If the page is cached correctly, I can see way more JS assets loaded in /wp-content/litespeed/js/. On incorrectly cached pages there are fewer JS files bundled/loaded.

    I’ve sent the plugin report as well, here’s the number: GJCCHNNO

    What could be causing this and how to prevent it?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Support Imageqtwrk

    (@qtwrk)

    this is weird issue

    have you tried to compare the html source code on both cases ?

    Thread Starter ImageKristián Filo

    (@kristianfilo)

    @qtwrk I’ve stumbled upon the broken category page again and I’ve compared the HTML source.

    The broken page is literally incomplete, it is trimmed at a random position, in the middle of a <a> link (its text) and after that there’s nothing. The text of that <a> link doesn’t even contain any special characters or anything. It seems like the build process of that static HTML page crashed at some point for some reason.

    Anyway, the part where it crashes is within the Complianz cookie banner. I’ve tried adding ‘complianz.js’ to the JS excludes, but I think this is random (and other broken pages are probably rendered up until a different part of the code).

    Anyway, some optimized CSS/JS code is being loaded after this part of the code, so that is why it’s missing from these broken pages.

    Is there a way to detect if page was optimized/built correctly and if not, attempt to optimize/cache it again?

    Plugin Support Imageqtwrk

    (@qtwrk)

    i feel like maybe

    1. the PHP process was crashed , or terminated prematurely for whatever reason
    2. something else interfered our plugin’s output buffer function , maybe other plug also use output buffer, and flushed our buffer as well

    does it always crash on the part related to Complianz ?

    meanwhile , did you see anything in php error log ?

    Thread Starter ImageKristián Filo

    (@kristianfilo)

    No, I’ve noticed it fails at random parts of the page (not only during Complianz banner rendering).

    I don’t see any relevant messages in error log, except for this one message from today:

    Cron reschedule event error for hook: litespeed_task_crawler, Error code: could_not_set, Error message: The cron event list could not be saved.., Data: {"schedule":"litespeed_crawl_filter","args":[],"interval":120}

    I don’t think output buffering conflict is the issue, it would probably be more frequent. The pages are OK in 99% of cases, I’m only noticing couple of broken pages per week.

    PHP termination seems reasonable, is there any way to prevent this? I mean – to only store the cache if the page was rendered and built completely? I have Crawler enabled with these settings:

    • 500 microseconds delay
    • 500 seconds run duration
    • 120 seconds interval between runs
    • 86400 seconds (24 hrs) crawl interval
    • 4 threads
    • 30 seconds timeout
    • 2 server load limit

    Some data from the last (active) crawler that might be helpful:

    • Last complete run time for all crawlers: 16014 seconds
    • Run time for previous crawler: 16014 seconds
    • Current server load: 1.15

    I am running a VPS with 32 PHP threads available (512 MB of RAM allocated for each). These are my PHP settings (which might be relevant):

    • max_execution_time: 600 s
    • max_input_time: 60 s
    • max_input_vars: 5000
    Plugin Support Imageqtwrk

    (@qtwrk)

    wait , please disable HTML minify , I see a case before certain html content may crash the HTML minify library that could potentially leave a weird or incomplete content , maybe it’s related.

    Thread Starter ImageKristián Filo

    (@kristianfilo)

    I disabled it. I’ll keep an eye on it and will update the thread with either result. Could you please leave the thread opened until then? Thank you.

    Plugin Support Imageqtwrk

    (@qtwrk)

    certainly

    Thread Starter ImageKristián Filo

    (@kristianfilo)

    Hi @qtwrk , I can confirm the issue still persists after disabling HTML minify.

    Plugin Support Imageqtwrk

    (@qtwrk)

    well , be honest I am not sure what else to look at this point

    this is kind of long shot , but let’s give it a try

    please go to debug setting , enable debug log , log level to advance, log size to 300MB , now try to reproduce again , and hopefully we can catch the log on a broken request

    Thread Starter ImageKristián Filo

    (@kristianfilo)

    Hi @qtwrk , sorry for late reply. I’ll try to enable the debug log with large size treshold.

    Just a question though, could enabling the log and setting its limit above 300 MB actually slow down the site? (disk space is not an issue, but I am worried about the speed)

    Plugin Support Imageqtwrk

    (@qtwrk)

    it will do few more write to disk , but assuming you are running on SSD/NVMe disk , then I think the impact should be negligible

    Thread Starter ImageKristián Filo

    (@kristianfilo)

    Hi @qtwrk ,

    I finally managet to catch a broken page in the log. The 2nd page of a category got broken, this is the URL (censored site link):

    mysite.com/kategoria/kovanie/vesiaky/page/2/

    This URL was not present in crawler log at all, but I found two instances in debug log. I am attaching it below. In the first one the cache is prevented with DONOTCACHEPAGE constant (this is OK, caching is prevented for logged in user), in the second instance the cache seems to be created and response is finished, but the cached page was incomplete (HTML content was cut/stripped somewhere in the footer/bottom bar).

    Debug log (I’ve only censored site URLs and IP addresses):

    05/06/25 06:53:28 - OC - Init Redis connection
    05/06/25 06:53:28 - OC - connecting to /dev/shm/sock-redis-p11168:0
    05/06/25 06:53:28 - OC - Connected
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] 💓 ------GET HTTP/1.1 (HTTPS) /kategoria/kovanie/vesiaky/page/2/
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] Query String:
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] HTTP_REFERER: https://mysite.com/kategoria/kovanie...
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit...
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] Accept Encoding: gzip, deflate, br, zstd
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] Cookie _lscache_vary: admin_bar:1;logged-in:1;wcml_currency:
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] X-LSCACHE: true
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] LSCACHE_VARY_COOKIE: ,wp-postpass_306c638d5521d5eda97f791feb6f7dfb
    05/06/25 06:53:28 - OC - Init Redis connection
    05/06/25 06:53:28 - OC - connecting to /dev/shm/sock-redis-p11168:0
    05/06/25 06:53:28 - OC - Connected
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] 💓 ------POST HTTP/1.1 (HTTPS) /wp-admin/admin-ajax.php
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] Query String:
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] HTTP_REFERER: https://mysite.com/kategoria/kovanie...
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit...
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] Accept: application/json, text/javascript, */*; q=0.01
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] Accept Encoding: gzip, deflate, br, zstd
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] Cookie _lscache_vary: admin_bar:1;logged-in:1;wcml_currency:
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] X-LSCACHE: true
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] LSCACHE_VARY_COOKIE: ,wp-postpass_306c638d5521d5eda97f791feb6f7dfb
    05/06/25 08:53:28.460 [ip_address:61759 1 9O7] [Ctrl] X Cache_control -> no Cache ( logged in user ) => LiteSpeed\Control::set_nocache(( logged in user ))@409 => LiteSpeed\Vary->after_user_init()@92 => LiteSpeed\LSC->after_user_init()@255 => WP_Hook->apply_filters(ARRAY)@324 => WP_Hook->do_action(ARRAY)@348 =>
    /var/www577/p11168/mysite.com/web/wp-settings.php@517
    05/06/25 08:53:28.460 [ip_address:61759 1 9O7] [Router] get_role: sales
    05/06/25 08:53:28.461 [ip_address:61759 1 9O7] [Media] init
    05/06/25 08:53:28.462 [ip_address:61759 1 9O7] 📺 Suppress default WP lazyload
    05/06/25 08:53:28.463 [ip_address:61759 1 9O7] [LQIP] init
    05/06/25 08:53:28.464 [ip_address:61759 1 9O7] [CDN] init
    05/06/25 08:53:28.464 [ip_address:61759 1 9O7] ⏰ Init
    05/06/25 08:53:28.465 [ip_address:61759 1 9O7] [Router] LSCWP_CTRL bypassed empty
    05/06/25 08:53:28.466 [ip_address:61759 1 9O7] [GUI] init
    05/06/25 08:53:28.520 [ip_address:7236 1 n2A] [Core] Footer hook called
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Core] CHK html bypass: not get method POST
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Ctrl] not cacheable before ctrl finalize
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Vary] show_admin_bar_front: true
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Vary] admin bar : true
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Vary] no custimzed vary
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Ctrl] ❌ forced no cache [reason] DONOTCACHEPAGE const
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] 💰 X-LiteSpeed-Cache-Control: no-cache
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] 💰 Cache-Control: no-cache, no-store, must-revalidate, max-age=0
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Vary] uid: 4753
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Vary] show_admin_bar_front: true
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Vary] admin bar : true
    05/06/25 08:53:28.609 [ip_address:7236 1 n2A] [Core] CHK html bypass: not get method POST
    05/06/25 08:53:28.609 [ip_address:7236 1 n2A] [Core] run hook litespeed_buffer_finalize
    05/06/25 08:53:28.609 [ip_address:7236 1 n2A] [Media] bypass: Not frontend HTML type
    05/06/25 08:53:28.609 [ip_address:7236 1 n2A] GUI bypassed by no counter
    05/06/25 08:53:28.609 [ip_address:7236 1 n2A] Response headers --- array (
    1 => 'Expires: Wed, 11 Jan 1984 05:00:00 GMT',
    2 => 'Content-Type: text/html; charset=UTF-8',
    3 => 'X-Pingback: https://mysite.com/xmlrpc.php',
    5 => 'Link: <https://mysite.com/hu/wp-json/>; rel="https://api.w.org/"',
    6 => 'Link: <https://mysite.com/hu/wp-json/wp/v2/product/3298>; rel="alternate"; type="application/json"',
    7 => 'Link: <https://mysite.com/hu/?p=3298>; rel=shortlink',
    8 => 'X-LiteSpeed-Cache-Control: no-cache',
    9 => 'Cache-Control: no-cache, no-store, must-revalidate, max-age=0',
    )
    05/06/25 08:53:28.609 [ip_address:7236 1 n2A] End response
    --------------------------------------------------Duration: 2,507.38 ms------------------------------


    05/06/25 06:53:28 - OC - Init Redis connection
    05/06/25 06:53:28 - OC - connecting to /dev/shm/sock-redis-p11168:0
    05/06/25 06:53:28 - OC - Connected
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] 💓 ------GET HTTP/1.1 (HTTPS) /kategoria/kovanie/vesiaky/page/2/
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] Query String:
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] HTTP_REFERER: https://mysite.com/kategoria/kovanie...
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit...
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] Accept Encoding: gzip, deflate, br, zstd
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] Cookie _lscache_vary: admin_bar:1;logged-in:1;wcml_currency:
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] X-LSCACHE: true
    05/06/25 08:53:28.088 [ip_address:13410 1 bDT] LSCACHE_VARY_COOKIE: ,wp-postpass_306c638d5521d5eda97f791feb6f7dfb
    05/06/25 06:53:28 - OC - Init Redis connection
    05/06/25 06:53:28 - OC - connecting to /dev/shm/sock-redis-p11168:0
    05/06/25 06:53:28 - OC - Connected
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] 💓 ------POST HTTP/1.1 (HTTPS) /wp-admin/admin-ajax.php
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] Query String:
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] HTTP_REFERER: https://mysite.com/kategoria/kovanie...
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit...
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] Accept: application/json, text/javascript, */*; q=0.01
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] Accept Encoding: gzip, deflate, br, zstd
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] Cookie _lscache_vary: admin_bar:1;logged-in:1;wcml_currency:
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] X-LSCACHE: true
    05/06/25 08:53:28.289 [ip_address:13410 1 DoR] LSCACHE_VARY_COOKIE: ,wp-postpass_306c638d5521d5eda97f791feb6f7dfb
    05/06/25 08:53:28.460 [ip_address:61759 1 9O7] [Ctrl] X Cache_control -> no Cache ( logged in user ) => LiteSpeed\Control::set_nocache(( logged in user ))@409 => LiteSpeed\Vary->after_user_init()@92 => LiteSpeed\LSC->after_user_init()@255 => WP_Hook->apply_filters(ARRAY)@324 => WP_Hook->do_action(ARRAY)@348 =>
    /var/www577/p11168/mysite.com/web/wp-settings.php@517
    05/06/25 08:53:28.460 [ip_address:61759 1 9O7] [Router] get_role: sales
    05/06/25 08:53:28.461 [ip_address:61759 1 9O7] [Media] init
    05/06/25 08:53:28.462 [ip_address:61759 1 9O7] 📺 Suppress default WP lazyload
    05/06/25 08:53:28.463 [ip_address:61759 1 9O7] [LQIP] init
    05/06/25 08:53:28.464 [ip_address:61759 1 9O7] [CDN] init
    05/06/25 08:53:28.464 [ip_address:61759 1 9O7] ⏰ Init
    05/06/25 08:53:28.465 [ip_address:61759 1 9O7] [Router] LSCWP_CTRL bypassed empty
    05/06/25 08:53:28.466 [ip_address:61759 1 9O7] [GUI] init
    05/06/25 08:53:28.520 [ip_address:7236 1 n2A] [Core] Footer hook called
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Core] CHK html bypass: not get method POST
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Ctrl] not cacheable before ctrl finalize
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Vary] show_admin_bar_front: true
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Vary] admin bar : true
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Vary] no custimzed vary
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Ctrl] ❌ forced no cache [reason] DONOTCACHEPAGE const
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] 💰 X-LiteSpeed-Cache-Control: no-cache
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] 💰 Cache-Control: no-cache, no-store, must-revalidate, max-age=0
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Vary] uid: 4753
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Vary] show_admin_bar_front: true
    05/06/25 08:53:28.598 [ip_address:7236 1 n2A] [Vary] admin bar : true
    05/06/25 08:53:28.609 [ip_address:7236 1 n2A] [Core] CHK html bypass: not get method POST
    05/06/25 08:53:28.609 [ip_address:7236 1 n2A] [Core] run hook litespeed_buffer_finalize
    05/06/25 08:53:28.609 [ip_address:7236 1 n2A] [Media] bypass: Not frontend HTML type
    05/06/25 08:53:28.609 [ip_address:7236 1 n2A] GUI bypassed by no counter
    05/06/25 08:53:28.609 [ip_address:7236 1 n2A] Response headers --- array (
    1 => 'Expires: Wed, 11 Jan 1984 05:00:00 GMT',
    2 => 'Content-Type: text/html; charset=UTF-8',
    3 => 'X-Pingback: https://mysite.com/xmlrpc.php',
    5 => 'Link: <https://mysite.com/hu/wp-json/>; rel="https://api.w.org/"',
    6 => 'Link: <https://mysite.com/hu/wp-json/wp/v2/product/3298>; rel="alternate"; type="application/json"',
    7 => 'Link: <https://mysite.com/hu/?p=3298>; rel=shortlink',
    8 => 'X-LiteSpeed-Cache-Control: no-cache',
    9 => 'Cache-Control: no-cache, no-store, must-revalidate, max-age=0',
    )
    05/06/25 08:53:28.609 [ip_address:7236 1 n2A] End response
    --------------------------------------------------Duration: 2,507.38 ms------------------------------

    Let me know if you see anything suspicious. Thank you.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Some JS assets randomly not loading on cached pages’ is closed to new replies.