As an experienced website operations expert, I know that AnQiCMS is widely popular among small and medium-sized enterprises and content operation teams due to its efficient Go language features.However, even the most efficient systems may encounter some "little setbacks" in a specific operating environment.Today, let's talk about a seemingly mysterious yet often困扰ing issue for technical maintenance personnel - when the AnQiCMS service appears to have stopped, there are still "zombie processes" lingering, what is the matter with that?How should we diagnose and solve it?

AnQiCMS “zombie process” diagnosis and response: In-depth analysis of the hidden corners of residual processes after shutdown

In the daily operation and maintenance of AnQiCMS, we occasionally encounter such situations: although the stop command has been executed, even the server has been restarted, the AnQiCMS service seems to be far from completely "offline", manifested as the port is still occupied, or the background management interface cannot start normally.This often means that there are 'zombie processes' at work in the shadows. Here, 'zombie processes' do not refer to the traditional sense of child processes waiting to be reclaimed by their parent processes, but rather to those processes that should have exited but failed to release resources completely, lurking in system resources like ghosts, affecting the normal startup of services.

AnQiCMS is developed based on the Go language, its high performance and concurrent processing capabilities make it usually very robust in process management.The exit mechanism of Go programs is relatively direct, and the probability of traditional zombie processes in native Go applications is relatively low.Therefore, we encounter more residual service issues due to external environment, script execution, or forced interruption.

Step 1: Confirm the “real status” of AnQiCMS

When encountering such a problem, the first thing we should do is not rush to act, but to remain calm and carefully confirm the actual running status of AnQiCMS.

  1. Website access checkTry to access your AnQiCMS website address and admin address through the browser (for examplehttp://yourdomain.com/system/If the website cannot be accessed, or shows a connection timeout, this may initially indicate that the service has stopped.
  2. Service status checkIf you configure AnQiCMS as a Systemd service (common on Linux) or run it through Baota panel or other management tools, please check the current status of the service. For example, you can try running it in the Linux command line.systemctl status AnQiCMS(If your service name is AnQiCMS). Check the output information to confirm that the service is in the "inactive (dead)" state.
  3. Review start/stop script log: The AnQiCMS deployment document mentions that we usually usestart.shandstop.shscripts to manage services. Please check the log files generated by these scripts (for examplerunning.logandcheck.logThis log is usually located in the root directory of AnQiCMS. It records the execution process of the script and the start/stop status of the AnQiCMS process, and may contain useful error information.

Second step: Deepen the process list, identify zombie traces

After confirming that the service may have stopped but still has exceptions, the next step is to delve into the operating system level to find those stubborn residual processes.

  1. UsepsCommand to find processIn Linux or macOS systems,psis a powerful tool for finding processes. You can use the following command to list all processes related to AnQiCMS:
    
    ps -ef | grep anqicms | grep -v grep
    
    This command lists all processes containing the keyword 'anqicms' at the same timegrep -v grepIt will filter outgrepCommanding its own process makes the result clearer. Observe carefullySTAT(Status) column. If you see the process status asZ(Zombie, zombie) indicates that there is indeed a traditional zombie process. However, it is more common to see some processes that do not haveZstatus, but still show asanqicmsThis might be what we call 'zombie processes'——they may have stopped running, but the PID (Process ID) is still held by the system, or resources have not been fully released.
  2. UselsofCheck command port occupancyThe AnQiCMS runs on port 8001 by default (unless you manually change it). A common error when the service fails to start is that the port is occupied.lsofThe command can help us find which process is listening on the port:
    
    lsof -i:8001
    
    If this command returns a result showing the PID of the AnQiCMS process, then congratulations, you have found the culprit! Even if the process is runningpsThe list looks like it has stopped, but the fact that the port is occupied indicates that it has not completely exited.

Step 3: Investigate the cause of the 'zombie process' in AnQiCMS.

After understanding the phenomenon, we need to explore the reasons behind it more, which helps us solve the problem fundamentally.

  1. stop.shin the scriptkill -9Based on AnQiCMS'sinstall.mdandstart.mdDocument,stop.shThe script usually useskill -9 $exists.kill -9It is a强制终止信号,It will directly kill the process,without giving the process any opportunity to clean up resources.Although this "decapitation" method can ensure that the process stops immediately, it may also cause some resources (such as file locks, memory pages, etc.) to not be recovered in time by the system, especially in cases of sudden process crashes or being forcibly killed during cleanup processes.This might be the cause of 'fake zombies' or resource residue.
  2. The characteristics of Go language processesThe Go language runtime manages its goroutines and memory, and Go programs usually clean up resources properly when they exit. Therefore, in the traditional sense,