웹서버와 연결이 종료되지 않는 문제

by freemir posted Sep 10, 2013

* 질문 등록 시 다음의 내용을 꼭 기입하여 주세요.
OS
 CentOS 6.4 64bit
CUBRID Ver.
 CUBRID 2008 R2.2 (8.2.2.10007) (Oct  5 2011 20:26:14)
CUBRID TOOL Ver.

응용 환경(API)
 PHP 5.3

* CUBRID 응용 오류, SQL 오류 또는 SQL 튜닝 관련된 문의는 반드시 다음의 내용을 추가해 주세요. 비밀글이나 비밀 댓글도 가능합니다.
* 저희가 상황을 이해하고, 재현이 가능해야 알 수 있는 문제들이 많습니다. 가능한 정보/정황들을 부탁합니다.
에러 내용 및 재현 방법 재현 가능한 Source와 SQL
관련 테이블(인덱스, 키정보 포함) 정보 CUBRID 홈 디렉토리 아래 log 디렉토리 압축


-------------- 아래에 질문 사항을 기입해 주세요. ------------------------------------------------------------------------

CUBRID 2008 R2.2 로 HA 구성 후 사용 중입니다.


사용 도중 웹 서버와 데이터베이스 간 연결이 종료되지 않는 현상이 가끔씩 발생합니다.


# ps axfwwu

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND

root         2  0.0  0.0      0     0 ?        S    Aug15   0:00 [kthreadd]

root         3  0.0  0.0      0     0 ?        S    Aug15   0:06  _ [migration/0]

root         4  1.5  0.0      0     0 ?        S    Aug15 173:31  _ [ksoftirqd/0]

(중략)

nobody   23267  0.2  0.2 405196 24280 ?        S    19:02   0:06  _ /usr/sbin/httpd

nobody   23269  0.9 84.7 11991060 8576464 ?    S    19:02   0:29  _ /usr/sbin/httpd

nobody   23320  0.1  0.2 404400 23456 ?        S    19:03   0:05  _ /usr/sbin/httpd

(하략)

 

# pstack 23269

#0  0x00007fa12dbc64d3 in __select_nocancel () from /lib64/libc.so.6

#1  0x00007fa122101384 in cci_disconnect () from /opt/webapps/cubrid822/lib/libcascci.so.8

#2  0x00007fa1223270b5 in close_cubrid_connect () from /usr/lib64/php/modules/cubrid.so

#3  0x00007fa12497d595 in ?? () from /etc/httpd/modules/libphp5.so

#4  0x00007fa12497a3a5 in ?? () from /etc/httpd/modules/libphp5.so

#5  0x00007fa12497a628 in zend_hash_graceful_reverse_destroy () from /etc/httpd/modules/libphp5.so

#6  0x00007fa12496e7d6 in ?? () from /etc/httpd/modules/libphp5.so

#7  0x00007fa12491c8e5 in php_request_shutdown () from /etc/httpd/modules/libphp5.so

#8  0x00007fa1249f6bd7 in ?? () from /etc/httpd/modules/libphp5.so

#9  0x00007fa12f5d4bb0 in ap_run_handler ()

#10 0x00007fa12f5d846e in ap_invoke_handler ()

#11 0x00007fa12f5e3b30 in ap_process_request ()

#12 0x00007fa12f5e09a8 in ?? ()

#13 0x00007fa12f5dc6b8 in ap_run_process_connection ()

#14 0x00007fa12f5e8977 in ?? ()

#15 0x00007fa12f5e8c8a in ?? ()

#16 0x00007fa12f5e990c in ap_mpm_run ()

#17 0x00007fa12f5c0900 in main ()


# lsof p 23269

COMMAND   PID   USER   FD   TYPE   DEVICE SIZE/OFF     NODE NAME

httpd   23269 nobody  cwd    DIR      8,3     4096        2 /

httpd   23269 nobody  rtd    DIR      8,3     4096        2 /

httpd   23269 nobody  txt    REG      8,3   354816   150604 /usr/sbin/httpd

(중략)

httpd   23269 nobody   15w   REG      8,3   210979  1182258 /var/log/httpd/ssl_access_log

httpd   23269 nobody   16w   REG      8,3   223571  1182262 /var/log/httpd/ssl_request_log

httpd   23269 nobody   17r   CHR      1,9      0t0     3690 /dev/urandom

httpd   23269 nobody   18u   REG      0,9        0     3683 anon_inode

httpd   23269 nobody   19u  sock      0,6      0t0 20357456 can't identify protocol

httpd   23269 nobody   21u  IPv4 20357457      0t0      TCP web3:34398->121.xxx.xxx.xxx:41000 (CLOSE_WAIT)


위와 같이 CLOSE_WAIT 상태에서 Deadlock 상태로 메모리를 과다하게 점유하는 현상이 발생합니다.



같은 시간대는 아니지만 해당 증상 발생 시 브로커 쪽 로그는 다음과 같습니다.



Time: 09/09/13 15:58:38.465 - ERROR *** ERROR CODE = -743, Tran = -1, EID = 1

Failed on handshake between client and server. (peer host db-master)


*** The previous error message is the last one. ***



Time: 09/09/13 16:10:30.411 - ERROR *** ERROR CODE = -743, Tran = -1, EID = 1

Failed on handshake between client and server. (peer host db-master)


*** The previous error message is the last one. ***




서비스 구조는 db-broker1 -> db-master / db-slave 구성으로 되어있습니다.


어느 부분을 살펴봐야 할 지 조언 부탁드립니다.


Articles