'묵상(당신과의대화)' 카테고리의 다른 글

맞아..나는 없어야해...  (0) 2011.07.27
처음부터..  (0) 2011.07.27
구름기둥과 불기둥  (0) 2011.06.07
그래도 놓지 말아야 할것은...  (1) 2011.04.27
보리떡 5개와 물고기 2 마리...  (0) 2011.04.08

리눅스 시스템을 운영하다 보면  시스템 Hang-up에 대한  문제점을 많이 들어나게 됩니다. 물론  리눅스 시스템
자체의 문제점이라고 보다는 특정 운영 프로세스에 대해서 인터럽트 또는 스케쥴이 정상적으로 진행되지 못했을때 나타는 문제점에 대해서 간략해 소개해 보고자 합니다.

갑자기 시스템  로그에서 출력하게된 /var/log/message 의 시스템 로그.

kernel: INFO: task startup.sh:9902 blocked for more than 120 seconds.
 kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this messag
 kernel: startup.sh    D 0000000000000008     0  9902   7811 0x00000004
 kernel: ffff880828f17ce8 0000000000000082 ffff88081c2aeaa0 ffff88081c2aeaa0
 kernel: ffff88081c2aeaa0 ffffea00378c0d98 ffff88081c2aeaa0 0000010100001e60
 kernel: ffff88081c2af058 ffff880828f17fd8 000000000000fb88 ffff88081c2af058
 kernel: Call Trace:
 kernel: [<ffffffffa00accf0>] ? ext4_file_open+0x0/0x130 [ext4]
 kernel: [<ffffffff814eae85>] schedule_timeout+0x215/0x2e0
 kernel: [<ffffffff81174234>] ? nameidata_to_filp+0x54/0x70
 kernel: [<ffffffff81268d39>] ? cpumask_next_and+0x29/0x50
 kernel: [<ffffffff814eab03>] wait_for_common+0x123/0x180
 kernel: [<ffffffff8105fa40>] ? default_wake_function+0x0/0x20
 kernel: [<ffffffff814eac1d>] wait_for_completion+0x1d/0x20
 kernel: [<ffffffff8106155c>] sched_exec+0xdc/0xe0
 kernel: [<ffffffff8117ee90>] do_execve+0xe0/0x2c0
 kernel: [<ffffffff810095ea>] sys_execve+0x4a/0x80
 kernel: [<ffffffff8100b4ca>] stub_execve+0x6a/0xc0

[예상 문제점 1]
시스템 로그에서 나타난  kernel:INFO: task 의 메세지를 나타내는 의미는 현재 운영하고자 하는 startup.sh
스크립트에 대해서  120초 (2분 default) 동안 khungtaskd  쓰레드에서 D-state 상태를 감지하여  call trace
를 호출하게 되는  상황으로 예측할 수 있습니다. 

[예상 문제점2]
시스템의 성능저하 특히 레드햇의 보고서에 의하면 디스크의 heavy I/O 로 나타나는 문제점으로
예측될수 있습니다.

[예상 문제점 2]
운영되고 있는 Application에 대해서 "D-state" (Uninterruptible sleep) 모드가 120초 동안 지속되었을때
예측될수 있는 문제로  해당 프로세스가 정상적으로 스케쥴링이 일어나지 않았을 때도 나타나게 됩니다

[ D-state 원인분석을 위해서는 ? ]
위와같은 문제점에 대해서 접근할수 있는 기본적인 방법에 대해서는  정확한 문제점을  파악하기 위해서는  커널의 덤프를 이용하여 core를 분석하는 것이 가장 정확할수 있습니다. core를 분석하기 위한 방법론에 대해서는 다음
블로깅을 통하여 소개하도록 하겠습니다.

# echo 1 > /proc/sys/kernel/hung_task_panic

위와 같이  kernel core를  생성하기 위해 설정을 진행한 후 동일한 현생이 발생되어 core가 생성이 되면 문제가
되는 운영 프로세스의 D-state 문점에 대해서 분석이 가능합니다.

[ hung_task_timeout을 Disable 시켜라]
기본적인 Work-Arround에 대해서는  아래와 같이 hung_task_timeout 부분에 대해서 Disable 시켜주는 것을 권장하고 있습니다.

#  echo 0 > /proc/sys/kernel/hung_task_timeout_secs

위와 같이  커널에서 Hang Time OUt 을 체크하는 부분에 대해서 Disable 시켜준 후에는  call trace 여부가 지속적으로 발생되는지  모니터링이 필요합니다. 만약  해당 프로세스에 대해서  Uninterrupt sleep이 지속적으로 발생한다면 커널 업데이트 또한 고려해야 합니다.


일반적으로 레드햇 계열 (RedHat, CentOS, SUSE Linux)에서 패키지 관리에 사용되는 강력한 기능중에 YUM
기능은 패키지 의존성 (Dependency)를  고려해서 안전하게  패키지를 설치 구성이 가능한데 , 데비안 계열의
리눅스의 경우는 apt-get (Advanced Packaging Tool)이라고 하는 아주 쓸만한 놈이 있네요  다음과 같이 레드햇 계열의 리눅스에서 사용하고 있는 YUM과 비교해서 정리해 봅니다.

1. deb 패키지 정보에 대한 인덱스 저장소

apt-get은 패키지들에 대한 인덱스  정보를 기반으로  패키지 리스트를 가져오는데  yum의 repository와 유사한것으로 판단해도 무리는 없을듯 합니다.

경로는 : /etc/apt/sources.list


#deb cdrom:[Ubuntu 12.10 _Quantal Quetzal_ - Release amd64 (20121017.5)]/ quantal main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://kr.archive.ubuntu.com/ubuntu/ quantal main restricted
deb-src http://kr.archive.ubuntu.com/ubuntu/ quantal main restricted


## Major bug fix updates produced after the final release of the
## distribution.
deb http://kr.archive.ubuntu.com/ubuntu/ quantal-updates main restricted
deb-src http://kr.archive.ubuntu.com/ubuntu/ quantal-updates main restricted


## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://kr.archive.ubuntu.com/ubuntu/ quantal universe
deb-src http://kr.archive.ubuntu.com/ubuntu/ quantal universe
deb http://kr.archive.ubuntu.com/ubuntu/ quantal-updates universe
deb-src http://kr.archive.ubuntu.com/ubuntu/ quantal-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://kr.archive.ubuntu.com/ubuntu/ quantal multiverse
deb-src http://kr.archive.ubuntu.com/ubuntu/ quantal multiverse
deb http://kr.archive.ubuntu.com/ubuntu/ quantal-updates multiverse
deb-src http://kr.archive.ubuntu.com/ubuntu/ quantal-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://kr.archive.ubuntu.com/ubuntu/ quantal-backports main restricted universe multiverse
deb-src http://kr.archive.ubuntu.com/ubuntu/ quantal-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu quantal-security main restricted
deb-src http://security.ubuntu.com/ubuntu quantal-security main restricted
deb http://security.ubuntu.com/ubuntu quantal-security universe
deb-src http://security.ubuntu.com/ubuntu quantal-security universe
deb http://security.ubuntu.com/ubuntu quantal-security multiverse
deb-src http://security.ubuntu.com/ubuntu quantal-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu quantal partner
# deb-src http://archive.canonical.com/ubuntu quantal partner

## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu quantal main
deb-src http://extras.ubuntu.com/ubuntu quantal main


2. apt-get 을 이용한 패키지 설치 하기

이제 본격적으로  우분투에서 제공하는 apt-get을 이용한  패키지 설치는 진행해 봅니다. 아래와 같은 단계로 필요한 부분에 대해서 설치를 적절하게 진행 해보는 것도 도움이 됩니다.


2.1 패키지 설치와 업데이트

sudo apt-get install [패키지 명] : 설치하고자 하는 패키지를 검색하여 설치를 진행
sudo apt-get upgrade : 패지키들에 대한 업그레이드 진행
sudo apt-get update : 전체 패키지를 검색하여  업데이트 대상의 패키지들을 자동 업데이트
sudo apt-get dist-upgrade : 패키지 업그레이드시 우선 의존성을 검증한후 설치를 진행
sudo apt-get --reinstall [패키지명] :  재설치 하고자 하는 패키지를 설치

2.2 패키지 검색 및 삭제

sudo apt-cache search [Package Name] : 원하는 패키지를 검색하고자 할때 사용
sudo apt-get remove [Package Name] : 원하는 패키지를 삭제하고자 할때 사용
sudo apt-get source [Package Name] : 원하는 패키지의 소스 코드를 받고자 할때 사용
sudo apt-get build-dep [Package Name] : OnLIne에서 받은 패키지를 ㅏ현시스템의 의존성에 맞게 빌드
sudo apt-cache show [Package Name] : 원하는 패키지들에 대한 상세정보 볼수 있다.

apt-get 으로 설치된 모든 패키지 들은  아래의 경로에 따라 자동 저장이 됩니다. 나중에 설치된 우분투 패키지를
찾고자 할때  유용하게 확인할수 있습니다.

deb package path : /var/cache/apt/archive


+ Recent posts