litespeedtech / litespeedtech/lsmcd

PHP Fatal Error with LSMCD

Open
#35 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
39
Forks
18
PR merge metrics
No merged PRs in 30d

Description

Hi,

I'm running the latest version of LSMCD on Cloudlinux 8.9 with cPanel.

I have installed lsmcd using the cpanel install script and the lsmcd service is up and running.
However we keep getting a PHP Fatal Error on the website:

> [30-Jul-2024 07:04:48 UTC] PHP Fatal error: Uncaught TypeError: get_object_vars(): Argument #1 ($object) must be of type object, string given in /home/murmaiderco/public_html/wp-includes/class-wp-term.php:198
Stack trace:
#0 /home/murmaiderco/public_html/wp-includes/class-wp-term.php(198): get_object_vars()
#1 /home/murmaiderco/public_html/wp-includes/class-wp-term.php(184): WP_Term->__construct()
#2 /home/murmaiderco/public_html/wp-includes/taxonomy.php(971): WP_Term::get_instance()
#3 /home/murmaiderco/public_html/wp-includes/class-wp-term-query.php(1132): get_term()
#4 /home/murmaiderco/public_html/wp-includes/class-wp-term-query.php(828): WP_Term_Query->populate_terms()
#5 /home/murmaiderco/public_html/wp-includes/class-wp-term-query.php(311): WP_Term_Query->get_terms()
#6 /home/murmaiderco/public_html/wp-includes/taxonomy.php(1332): WP_Term_Query->query()
#7 /home/murmaiderco/public_html/wp-includes/taxonomy.php(2291): get_terms()
#8 /home/murmaiderco/public_html/wp-includes/taxonomy.php(3804): wp_get_object_terms()
#9 /home/murmaiderco/public_html/wp-includes/post.php(7804): update_object_term_cache()
#10 /home/murmaiderco/public_html/wp-includes/class-wp-query.php(3334): _prime_post_caches()
#11 /home/murmaiderco/public_html/wp-includes/class-wp-query.php(3824): WP_Query->get_posts()
#12 /home/murmaiderco/public_html/wp-includes/class-wp.php(696): WP_Query->query()
#13 /home/murmaiderco/public_html/wp-includes/class-wp.php(816): WP->query_posts()
#14 /home/murmaiderco/public_html/wp-includes/functions.php(1336): WP->main()
#15 /home/murmaiderco/public_html/wp-blog-header.php(16): wp()
#16 /home/murmaiderco/public_html/index.php(17): require('/home/murmaider...')
#17 {main}
thrown in /home/murmaiderco/public_html/wp-includes/class-wp-term.php on line 198

Things I have tried to fix this already without success.

- Installing libmemcached-awesome, copying the files to the right locations and running a cagefsctl --force-update
- Stopping lsmcd and removing /dev/shm/lsmcd and starting it again
- Putting posts, post_meta, users, user_meta in the "Do Not Cache Groups" in the litespeed-cache plugin.
- Switching PHP versions
- Purging the cache in the litespeed-cache plugin

When enabling LogLevel=dbg_medium in the node.conf, I can see that when the page tries to load, there is data being sent up and down to lsmcd, the user is authenticating successfully.

my node.conf is:

#-------------------------------------
Repl.HeartBeatReq=30
Repl.HeartBeatRetry=3000
Repl.MaxTidPacket=2048000
Repl.GzipStream=YES
Repl.LbAddrs=127.0.0.1:12340
Repl.ListenSvrAddr=127.0.0.1:12340
REPL.DispatchAddr=127.0.0.1:5501
RepldSockPath=/tmp/repld.usock
CACHED.PRIADDR=127.0.0.1:11000

CACHED.ADDR=127.0.0.1:11211
#CACHED.ADDR=UDS:///tmp/lsmcd.sock
#default is 8, it can be bigger depending on cache data amount
Cached.Slices=8
Cached.Slice.Priority.0=100
Cached.Slice.Priority.1=100
Cached.Slice.Priority.2=100
Cached.Slice.Priority.3=100
Cached.Slice.Priority.4=100
Cached.Slice.Priority.5=100
Cached.Slice.Priority.6=100
Cached.Slice.Priority.7=100

Cached.ShmDir=/dev/shm/lsmcd
Cached.UseSasl=true
Cached.DataByUser=true
Cached.Anonymous=false
Cached.SaslDB=/etc/sasllsmcd

##this is the global setting, no need to have per slice configuration.
User=nobody
Group=nobody
#depends CPU core
CachedProcCnt=8
CachedSockPath=/tmp/cached.usock.
TmpDir=/tmp/lsmcd
#LogLevel=notice
LogLevel=dbg_medium
LogFile=/tmp/lsmcd.log
#-------------------------------------

The lsmcd.conf log file attached contains the entries of when we try load a pages that's giving the fatal errors.
[lsmcd.log](https://github.com/user-attachments/files/16424129/lsmcd.log)

What makes this worse, is it's not consistent, if we refresh the home page enough times, eventually it displays, but then intermittently gives the php fatal error. other pages will give a fatal error and after enough refreshes, it will generate the page without css, then on the next refresh its back to the php fatal error.

With memcached disabled in the litespeed-cache plugin, the site works perfect, its only when using memcached is enabled that this occurs. Testing the website with redis also works 100% without fatal errors.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the intermittent fatal error with LiteSpeed Cache memcached enabled and Redis or memcached disabled for comparison. Inspect the provided lsmcd.log alongside node.conf, then trace the reported WordPress path through wp-includes/class-wp-term.php and taxonomy.php; done means the site loads consistently without the TypeError while lsmcd caching remains enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.