If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

Handling Memcached Crashes

Started by jina, Sep 13, 2024, 12:17 AM

Previous topic - Next topic

jinaTopic starter

Sep 11 17:44:18 seotuning kernel: memcached[16499]: segfault at 0 ip 000055644657d1a0 sp 00007f7057a2b990 error 4 in memcached[55644656f000+19000]
Sep 11 17:44:18 seotuning systemd: memcached.service: main process exited, code=killed, status=11/SEGV
Sep 11 17:44:18 seotuning systemd: Unit memcached.service entered failed state.
Sep 11 17:44:18 seotuning systemd: memcached.service failed.

Memcash, Centos 7 often chrashes, crash message up.

Can we monitor this service configure?
  •  

IMocymaync

It's not "Memcash", it's "Memcached", so let's get that straight, aight?

Now, you're seeing segfaults, and your service is crashing. That's no good, innit? Let's monitor this blighter and see what's going on.

Check memcached logs: Memcached logs to syslog by default. You've already seen some logs in your question, but let's make sure they're not getting flooded. Check your /var/log/messages or /var/log/syslog file for more insights. You can use commands like tail -f to monitor the logs in real-time. If it's getting too noisy, consider setting up a dedicated log file for memcached.

sudo tail -f /var/log/messages | grep memcached

Check memcached service status: Always a good idea to check if your service is actually running.

sudo systemctl status memcached

Monitor memcached usage: You can use the memstats command to check memcached usage. It'll give you info about memory, threads, and more.

memstats

Check for OOM Killer: If your server is running out of memory, the Linux Out-Of-Memory (OOM) killer might be the culprit. Check if it's been triggered with:

sudo cat /var/log/messages | grep -i 'out of memory'

Monitor system resources: Keep an eye on your CPU and memory usage. If they're consistently high, that could be causing your crashes.

sudo atop -r -p -v -w 5

Configure systemd to restart on failure: If your service keeps crashing, you can configure systemd to automatically restart it. Edit the memcached service file:

sudo nano /etc/systemd/system/memcached.service

Add or modify the Restart and RestartSec options under the [Service] section:

[Service]
...
Restart=always
RestartSec=5
...

Save and close the file, then reload the systemd manager:

sudo systemctl daemon-reload

Investigate the segfault: The segfault message you're seeing points to a specific address in the memcached binary. You can use gdb (GNU Debugger) to investigate further. First, install gdb:

sudo yum install gdb -y

Then, run:

gdb /usr/bin/memcached

In the gdb prompt, type run, then when it crashes, type bt to see a backtrace. This might help you pinpoint the exact cause of the segfault.
Don't go blaming the whole system for one faulty service. It's probably just a configuration issue or a dodgy memory allocation. Keep monitoring, and you should be able to sort this out.
  •  

adamekliczko

plugin, which is a type of PHP driver, is causing your server to shutdown. It's important to keep everything updated, because sometimes using an older version can lead to compatibility issues or significant problems.
  •  

DispManag

Switching to redis gradual be best. Setup easy, install tough. Stats view convenient.
  •  


If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...