´ÙÀ½ ÀÌÀü Â÷·Ê

5. ¹®Á¦°¡ ÀÖ³ª¿ä?

5.1 ¾î¶»°Ô ¿ø°ÝÁö ¿¬°áÀ» Çã¿ëÇϴ°¡?

¿ø°ÝÁö Ŭ¶óÀ̾ðÆ®¸¦ À§ÇØ µè°í ÀÖ´Ù°¡, ¿¬°áÀ» À§ÇØ sqlexec ÇÁ·Î¼¼½º¸¦ ½ÇÇàÇÏ´Â(fire off) sqlexecd ³»ÀÇ ¹ö±× #97893 (¸®´ª½º¿¡ ±¹ÇѵÈ)¿Í #97889 (¼Ö¶ó¸®½º¿¡ ±¹ÇÑµÈ °ÍÀ¸·Î °£ÁֵǴÂ)·Î ÀÎÇØ, sqlexec ¼¼¼ÇÀÌ Á¾·áµÉ ¶§ ÇÁ·Î¼¼½º Å×ÀÌºí¿¡ Á»ºñ¸¦ ³²±ä´Ù. ( ÇÁ·Î¼¼½º Å×À̺íÀÇ ÀÌ Á»ºñµéÀº ¹«¾ùÀΰ¡?¿Í ±×°ÍµéÀº ¾î¶»°Ô ¹æÁöÇϴ°¡?¸¦ º¼°Í). ÀÌ °æ°í¸¦ µè°íµµ ´ç½ÅÀÌ ¿©ÀüÈ÷ °íÁýÇÑ´Ù¸é, ÀÌ·¸°Ô Çضó:

5.2 ÇÁ·Î¼¼½º Å×À̺íÀÇ ÀÌ Á»ºñµéÀº ¹«¾ùÀΰ¡?

±×°ÍµéÀº ÀÎÆ÷¹Í½º ½ÄÀ¸·Î ¸»Çϸé "¿ì¸®´Â ȸÃʸ®¸¦ ¸Â¾ÒÁö¸¸ °è¼Ó ¶Èµü°Å¸°´Ù!"ÀÌ´Ù. ;-) ÁøÁöÇÏ°Ô, ±×°ÍµéÀº ¹ö±× #97893ÀÇ Ç¥ÃâÀÌ´Ù. ÀÌ ¹ö±×´Â µ¥ÀÌÅͺ£À̽º¿¡ ´ëÇÑ ¿ø°ÝÁö Á¢±ÙÀ» Á¦°øÇϱâ À§ÇØ ¼ÒÄÏ(sesoctcp)À» »ç¿ëÇÒ ¶§ °¡Àå ºó¹øÇÏ°Ô ¹ß»ýÇÏ´Â °Í °°´Ù. ·ÎÄà ¿¬°á »ó¿¡¼­ ¹«¸í ÆÄÀÌÇÁ(seipcpip)¸¦ »ç¿ëÇÒ¶§µµ ¹ß»ýÇÑ´Ù´Â º¸°íµµ ÀÖ´Ù. Àç¹ÌÀÖ´Â °ÍÀº glibc ¸±¸®Áî¿¡¼­ ¹ö±× #97893 °¡ ¼öÁ¤µÇ¾úÁö¸¸, »õ·Î¿î ¹ö±× #101155 °¡ µîÀåÇß´Ù´Â °ÍÀÌ´Ù: SEIPCPIP ¿¬°á ÇÁ·ÎÅäÄÝ(ÆÄÀÌÇÁ)°¡ ·¹µåÇÞ 5.1 Ç÷§Æû¿¡¼­ µ¿ÀÛÇÏÁö ¾Ê´Â °ÍÀÌ´Ù.

5.3 ±×°ÍµéÀ» ¾î¶»°Ô ¹æÁöÇϴ°¡?

Jonathan Leffler ( jleffler@informix.com)°¡ ȸÇÇÃ¥ nozombie.c ¸¦ °Ô½ÃÇߴµ¥, ±×°ÍÀº nohup°¡ °°Àº ¹æ½ÄÀ¸·Î »ç¿ëµÈ´Ù. ´ÙÀ½Àº JonathanÀÇ ÄÚµå¿Í ±×ÀÇ ¾ð±ÞÀÌ´Ù. ÀÌ°ÍÀº °ø½ÄÀûÀÎ(ÀÎÆ÷¹Í½º¿¡ ÀÇÇØ ÀÔÁõµÈ) ¼öÁ¤ÀÌ ¾Æ´Ï°í, ¸ðµç °æ¿ì¿¡ µ¿ÀÛÇÏ´Â °ÍÀº ¾Æ´Ï¶ó´Â º¸°íµµ ÀÖ´Ù´Â °Í¿¡ ÁÖÀÇÇ϶ó. YMMV.

¼³¸íÀº ²Ï °£´ÜÇÏ´Ù -- ¸¸ÀÏ ÇÁ·Î¼¼½º°¡ SIGCHLD¸¦ ¹«½ÃÇÑ´Ù¸é, ±×°ÍÀº Á»ºñ ÀڽĵéÀ» ½×Áö 
¾Ê´Â´Ù. ÇÁ·Î±×·¥Àº SIGCHLD¿¡ ´ëÇØ SIG_IGN ½Ã±×³Î ó¸® ¸ðµå¸¦ ¼³Á¤ÇÑ ´ÙÀ½ ÀÎÀÚ·Î 
ÁÖ¾îÁø °ÍÀ» ±×´ë·Î ½ÇÇàÇÑ´Ù. ¸¸ÀÏ ±×°ÍÀÌ sqlexecd¿¡ ¹ß»ýÇÑ´Ù¸é,
±×°ÍÀº SIGCHLD ½Ã±×³ÎÀ» ¹«½ÃÇÏ°Ô µÇ°í, ±×·¡¼­ ¿©±âÀú±â¿¡ Á»ºñ¸¦ ³²±âÁö ¾Ê´Â´Ù.


/*
@(#)File:            $RCSfile: nozombie.c,v $
@(#)Version:         $Revision: 1.1 $
@(#)Last changed:    $Date: 1998/08/20 21:24:40 $
@(#)Purpose:         Prevent process from accidentally creating zombies
@(#)Author:          J Leffler
@(#)Copyright:       (C) JLSS 1998
@(#)Product:         :PRODUCT:
*/
/*TABSTOP=4*/
#include <signal.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef lint
static const char rcs[] = "@(#)$Id: nozombie.c,v 1.1 1998/08/20 21:24:40 jleffler Exp $";
#endif
/*
** Exec program specified by arguments with SIGCHLD signals ignored.
** This ensures that unless the program re-enables the SIGCHLD signal
** handling, it does not leave zombies around, even if it doesn't
** clean up behind its children.  This works on POSIX.1 systems (such
** as Solaris 2.6 and Linux) pretty straight-forwardly.
**
** Motivation: the initial version of sqlexecd 7.24.UC1 on Linux
** caused problems with lots of zombies.
**
**      nozombie $INFORMIXDIR/lib/sqlexecd [service]
*/
int main(int argc, char **argv)
{
    signal(SIGCHLD, SIG_IGN);
    execv(argv[1], &argv[1]);
    fprintf(stderr, "Failed to execv() %s\n", argv[1]);
    return EXIT_FAILURE;
}

JonathanÀÇ ÄÚµå·Î ÇØ°áÀÌ ¾ÈµÇ¸é, ÃÖ±Ù¿¡ informix.idn.linux¿¡ ³ªÅ¸³­ ¹æ¹ýÀ» ½ÃµµÇØ º¸¶ó. ±×°ÍÀº signal ÇÔ¼ö°¡ ÀÛµ¿ÇÏ´Â ¹æ½ÄÀ» ÀçÀÛ¼ºÇÔÀ¸·Î½á Á»ºñ ¹®Á¦¸¦ ¼öÁ¤ÇÑ´Ù. ¸ÕÀú, ´ÙÀ½°ú °°ÀÌ signalfix.c ¸¦ ¸¸µç´Ù:


#include "signal.h"
#include <unistd.h>
#include <stdio.h>
void *signal(int signum,void (*handler)(int))
{
  struct sigaction sa;
  sa.sa_handler=handler;
  sa.sa_mask=SA_NOMASK;
  sa.sa_flags=SA_RESTART;
  sigaction(signum,&sa,(struct sigaction *)NULL);
}

´ÙÀ½À¸·Î, /usr/include/signal.h ¸¦ º¹»çÇÏ°í, ½Ã±×³Î ÇÔ¼ö¸¦ ÁÖ¼®Ã³¸® ÇÑ´Ù. ±×·± ´ÙÀ½, signalfix.c¸¦ ÀÌ·± ½ÄÀ¸·Î ÄÄÆÄÀÏÇÑ´Ù:

$ gcc -fpic -shared signalfix.c -o libsig.so

¸¶Áö¸·À¸·Î, sqlexecd ¸¦ ½ÇÇàÇÑ´Ù:

$ LD_PRELOAD=/root/sqlexecfix/libsig.so $INFORMIXDIR/lib/sqlexecd servername

5.4 DBACCESS°¡ xterm¿¡¼­ ¼¼±×¸ÕÅ×ÀÌ¼Ç ÆúÆ®¸¦ ¹ß»ý½ÃŲ´Ù!

Á÷Á¢ÀûÀÎ ¹®Á¦´Â dbaccess°¡ ¸í¹éÈ÷ termcap/terminfo Ç׸ñµéÀ» À¯ÁöÇÏ´Â Á¤ÀûÀÎ ¹öÆÛ¸¦ ÇÒ´çÇÏ°í ´ç½ÅÀÇ Ç׸ñÀÌ ÀÌ ¹öÆÛ°¡ À¯ÁöÇÏ´Â °Íº¸´Ù ±æ´Ù´Â °ÍÀÌ´Ù. °¡±î¿î ¹Ì·¡ÀÇ ¾î´À³¯ ©, ³ª´Â ÀÌ°ÍÀ» ÀÎÆ÷¹Í½º¿¡ º¸°íÇÒ °ÍÀÌ°í, ´ÙÀ½ ¸±¸®Áî »çÀÌŬ³»¿¡ ¼öÁ¤µÈ °ÍÀ» ¾ò±æ ¹Ù¶õ´Ù.

±× µ¿¾È¿¡ ȸÇÇÇÒ ¼ö ÀÖ´Â ¹æ¹ýÀº:

  1. $TERM ȯ°æ º¯¼ö¸¦ linux, vt220 ¶Ç´Â vt100°°Àº xtermÀÌ ¾Æ´Ñ ´Ù¸¥ °ÍÀ¸·Î º¯°æÇÑ´Ù
  2. termcapÀ̳ª terminfo³»ÀÇ °ü·ÃµÈ Ç׸ñµéÀ» ¼öÁ¤ÇÑ´Ù(¹°·Ð º¸°ü¿ë »çº»À» ¸¸µé¾îµÐ ÈÄ¿¡). - dbaccess´Â "ti"³ª "te" Ç׸ñÀ» »ç¿ëÇÏÁö ¾ÊÀ¸¹Ç·Î, ±×°ÍµéÀº »èÁ¦µÉ ¼ö ÀÖ´Ù. ÀÌ ¹æ¹ýÀº Àß µ¿ÀÛÇÏÁö¸¸, ti/te Ç׸ñÀ» ½ÇÁ¦·Î »ç¿ëÇÏ´Â ¸ðµç xterm¼¼¼Ç¿¡ ¿µÇâÀ» ¹ÌÄ£´Ù.
  3. xterm-dbaccess°°ÀÌ xterm Ç׸ñÀ» ±×´ë·Î º¹Á¦ÇÏ°í, "ti"¿Í "te"Ç׸ñÀ» »èÁ¦ÇÏ°í, ´ç½ÅÀÌ xterm â¿¡¼­ dbaccess¸¦ ½ÇÇàÇÒ ¶§ $TERMȯ°æ º¯¼ö¸¦ xterm-dbaccess·Î ¼³Á¤ÇÑ´Ù.
  4. http://www.informix.com/idn-secure/Linux/WebPages/termcap.html ¿¡¼­ ±¸ÇÒ ¼ö ÀÖ´Â ´ëü termcap/terminfo ÆÄÀÏÀ» »ç¿ëÇÑ´Ù. °Å±â¿¡ ³ª¿­µÈ °æ°í¿Í Á¦¾ðµé¿¡ ÁÖÀÇÇÒ °Í.

Roger Allen ( rja@sis.rpslmc.edu)Àº ¼¼ ¹ø° ¼±ÅÃÀ» ±ÇÀåÇÏ°í ¼³¸íÇϱ⸦

/etc/termcap³»¿¡ ´Ù¸¥ À̸§À¸·Î xterm Ç׸ñÀÇ »çº»À» ¸¸µé°í
»õ·Î¿î À̸§À» ´ç½ÅÀÇ TERM ¼³Á¤À¸·Î »ç¿ëÇϰųª ÇöÀç Ç׸ñÀ» º¯°æÇ϶ó.
¾î¶² ÀÎÆ÷¹Í½º ¸Å´º¾óÀÇ ºÎ·Ï ¾îµò°¡¿¡ ÀÎÆ÷¹Í½º°¡ »ç¿ëÇÏ´Â ÇʵåµéÀÇ ¸ñ·ÏÀÌ ÀÖ´Ù.
³ª´Â º¸Åë ti¿Í te¸¦ Çʵ带 »èÁ¦ÇÑ´Ù.
´ç½Åµµ DB-Accessº¸´Ù´Â ´Ù¸¥ ÀÎÆ÷¹Í½º ÅøµéÀ» ´õ¿í À§ÇÑ °ÍÀÌÁö¸¸,
¼± ±×¸®±â ¹®ÀÚ, ±×¸®°í ¸î°¡Áö ±â´É Å°µéÀ» ÇÒ¼ö ÀÖ°Ô ÇÏ´Â
Ưº°ÇÑ ÀÎÆ÷¹Í½º Ç׸ñÀ» Ãß°¡ÇÒ ¼ö ÀÖ´Ù.

5.5 ³»°¡ »ç¿ëÇÏ·Á´Â Æ÷Æ®°¡ ÀÌ¹Ì »ç¿ë ÁßÀÌ´Ù!

´Ù¸¥ °ÍÀ» »ç¿ëÇضó. ÀÎÁ¤¹ÞÀº ÀÎÆ÷¹Í½º Æ÷Æ®´Â 1546ÀÌÁö¸¸, ±×°ÍÀÌ »ç¿ëÇÏ´Â ¼ÒÄÏÀÌ ´Ù¸¥ ¼­ºñ½º¿¡ »ç¿ëµÇ´Â ÁßÀÌ ¾Æ´Ï¶ó¸é ¾î¶² °ÍÀÌ¶óµµ »ó°ü¾ø´Ù.

5.6 NFS-¸¶¿îÆ®µÈ ÆÄÀϽýºÅÛÀ» »ç¿ëÇÒ ¼ö Àִ°¡?

¾Æ´Ï´Ù. ´ç½ÅÀÇ µ¥ÀÌÅͺ£À̽º¸¦ º¸°üÇÒ ÆÄÀϽýºÅÛÀ» NFS¸¦ ÅëÇØ ¸¶¿îÆ®Çϱ⠺¸´Ù´Â,

  1. ¿ø°ÝÁö È£½ºÆ®¿¡ sqlexecd°¡ ½ÇÇàÁßÀ̾î¾ß ÇÏ°í,
  2. ¿ø°ÝÁö µ¥ÀÌÅͺ£À̽º¿¡ ³×Æ®¿÷À» »ç¿ëÇؼ­ Á¢±ÙÇؾ߸¸ ÇÑ´Ù.

SEÀÇ ¸®´ª½º ÀÌ¿ÜÀÇ ¹öÀüÀº ÀÌ°ÍÀ» ¹ÙÀ̳ʸ® ³»¿¡¼­ °­¿äÇÏÁö¸¸, ¸®´ª½ºÀÇ °æ¿ì¿¡´Â ÇØ´çµÇÁö ¾ÊÀ»Áöµµ ¸ð¸¥´Ù. Jonathan LefflerÀÇ Ãæ°í¿¡ µû¸£¸é, "¼ÓÀÓ¼ö¸¦ ¾²°íÀÚ ÇÑ´Ù¸é ¹®Á¦¸¦ ´ç¿¬ÇÑ ÀÏ·Î ¿©°Ü¶ó -- µ¥ÀÌÅÍ ¼Õ»ó ¹®Á¦µé" ÀÌ°ÍÀÌ ¹ÙÀ̳ʸ®¿¡ ÀÇÇØ °­¿äµÇµç ±×·¸Áö ¾Êµç, ´ç½ÅÀÇ µ¥ÀÌÅͺ£À̽º¸¦ NFS À§¿¡ ¸¶¿îÆ®ÇÏ´Â °ÍÀº (Àû¾îµµ) µÎ°¡Áö ÀÌÀ¯ ¶§¹®¿¡¶óµµ ÁÁÁö ¾ÊÀº »ý°¢ÀÌ´Ù:

  1. NFS°¡ ´À¸®±â ¶§¹®¿¡, Á¢±ÙÀÌ ´À·ÁÁú °ÍÀÌ´Ù.
  2. ¸¸ÀÏ NFS¸¶¿îÆ®¸¦ ÀÒ°Ô µÈ´Ù¸é, ´ç½ÅÀº ¾îÀ̾ø°Ô µÉ °ÍÀÌ°í, µ¥ÀÌÅͺ£À̽º ÆÄÀϵ鿡 ¹«½¼ ÀÏÀÌ »ý°åÀ»Áö´Â »·ÇÏ´Ù.


´ÙÀ½ ÀÌÀü Â÷·Ê