Linux Server death case analysis, linux Case Analysis

Source: Internet
Author: User

Linux Server death case analysis, linux Case Analysis

Symptom:

When running a specified script on a linux server, there will be countless identical processes, which will not be killed, and the system will be in an endless loop, login fails. You can only manually press the power key of the machine. Is this enough to crash?

Problem analysis process:

During the analysis, it is found that this specific script is somewhat special and has the same name as the existing command in the system.

Take the free command as an example:

The script name is free (. sh is not followed), and the free command is called in the script file.

This script is intended to call the free command to complete a task.

Is it because this will cause problems?

In fact, this will not cause any problems, because the script call is generally called in the following two ways:

Method 1: sh free

Method 2../free

If you execute free directly, it will call free in the system command, instead of the current script, then there will be no problem.

Another condition is the configuration of environment variables (the Environment configuration file in Linux may be. bash_profile. profle. bashrc ):

For the configuration of the PATH variable, if the variable contains., such

PATH =.:Xxx:/sbin:/bin:/usr/sbin

The PATH contains. then, what will happen? When executing the command, we will find the command in the current directory. If we add the vertex to the beginning of the PATH variable, in this case, the command is first searched in the current directory.

Then execute free in the current directory, and the script file named free will be executed, and the script file will call itself to form an endless loop.


Summary:

1. If a vertex is added to the PATH, the operating system searches for the command in the current directory when executing the command. If the vertex is placed at the beginning of the PATH, the command in the current directory is preferentially executed.

2. Do not set the script file command to the same as the system command, and do not remove the. sh suffix. Adhere to some basic development principles and avoid unnecessary troubles in many cases.


Zookeeper
Linux server crashes

There are many reasons for server crashes. Make sure that the hardware is correct.
You can check the overall performance status of the machine from logs in/var/log. You can use commands such as iostat or vmstat sar.
I don't know if you have implemented related monitoring measures, such as using some monitoring software to monitor the server.
Analyze the overall status of the server by monitoring data.
You can also coordinate the application department to check whether application logs are abnormal. This must be analyzed according to the actual situation.

Serial Port read/write failure in linux

This write will surely die .. writing (that is, sending data through the serial port) is not used so frequently. the landlord can add a sleep (1) After writing; this will not die ..
The Design of High-concurrency read/write is also incorrect and should be handled by queue ..
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.