디스크 풀났을때, 메세지큐의 이상현상

uamyd5279의 이미지

<global>
Q_Key[100];
Q_Name[100][16];

<main>
int qcnt =0 ;
...


...

qcnt = dGetMSQKey();

for( i =0; i< qcnt ; i++ ){

     return = msgget( arMSQ_key[i], 0 );
     if( return < 0 ){
         printf("LOG_%s:%d(%s)\n",Q_Name[i],Q_Key[i], strerror(errno) );
     }
     ...

}

int dGet_MSQ_key()
{
    FILE    *fa;
    char    szBuf[1024];
    int     qcnt;

    fa = fopen( QLIST, "r" );

    qcnt = 0;

    while( fgets( szBuf, 1024, fa ) != NULL ){

        lidx++;
        if( szBuf[0] != '#' ){
            printf("Row Format Unsuitable\n");
            fclose( fa );
            return -2;
        }

        if( szBuf[1] == '#')
            continue;
        else if( szBuf[1] == 'E' )
            break;
        else if( szBuf[1] == 'Q' ){
            sscanf( &szBuf[2], "%s %d",Q_Name[qcnt], &Q_Key[qcnt] );
            qcnt++;
        }
        else{
            printf("Unvalid File Format[%s]", QLIST );
            return -1;
        }
    }

    return qcnt;

}/* Get message key */

최대한 소스를 간략화 시켰고요,
간략하게 설명을 드리자면, 메세지큐가 여러개가 있어서,
그것들을 검사하는 기능을 가진 프로그램입니다.

그 중에서도 위에 부분은 QLIST라는 파일로부터, 큐이름과 큐값을 가지고 오는 부분인데요,

잠깐 보니, 코어가 발생하더군요.
알고보니, 시스템에서 "NO spase left on device"라는 메세지가 떨어지더군요.

dbx 로 돌려 보니, 위의 부분에서 qcnt값이 2800을 넘어가는( 참고로, 제가 사용하는 큐의 총합은 40을 넘지 않습니담) 값을 갖고 있더군요.

코드에 문제가 있는지 지적을 받고 싶어서 올렸습니다.

질문해주시면, 답변 드리겠습니다.

단소리 쓴소리 다 듣도록 하겠습니다. 조언좀 해주세요.~

uamyd5279의 이미지

< QLSIT >
##    주석입니다.
#Q    키이름1 키값1
#Q    키이름1 키값1
##
#E     끝라인

"For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life"-John 3:16

doldori의 이미지

코드와 Q_LIST의 내용을 보면 문제가 없어 보이는데요. 혹시 코드를 간략화하면서
빠진 내용에 문제가 있을지도 모르겠군요.
그리고
int Q_Key[100];
char Q_Name[100][16];
겠죠?

uamyd5279의 이미지

doldori wrote:

int Q_Key[100];
char Q_Name[100][16];
겠죠?

아 네 맞습니다.
그리고 간략화...주석지운게 다입니다.

"For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life"-John 3:16

nahanjang의 이미지

sscanf( &szBuf[2], "%s %d",Q_Name[qcnt], &Q_Key[qcnt] );

혹시 이부분이 문제있는거 아닌가요 파일의 Tab문제랄지...
uamyd5279의 이미지

nahanjang wrote:
sscanf( &szBuf[2], "%s %d",Q_Name[qcnt], &Q_Key[qcnt] );

혹시 이부분이 문제있는거 아닌가요 파일의 Tab문제랄지...

혹시나 해서 Tab은 사용하지 않고 Space만 사용했습니다. 빈칸하나칸씩...

그리고 디스크 풀이 아닌 경우, 제대로 작동을 합니다!!!

그래서 더 힘드네요. 디버깅을 어찌 해야할지...시스템에 영향을 받을 수 있는건지..

참고로 한가지 더 여쭈어 보자면..
msgget했을 경우 message queue ID가 0값으로 된 큐들이 많이 발생하는 건...어떤 이유인지 아시는분 계신가요...

로그로도 특별히 남지 않아서 매우 우울하네요..ㅜ.ㅡ

"For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life"-John 3:16

익명 사용자의 이미지

큐를 계속적으로 생성하므로 생성시 커널에 설정된 msg queue관련 설정치를 넘어서는것은 아닌지 ...
다음 명령으로 커널 설정을 확인할수 있습니다.

$> /sbin/sysctl -a | grep msg
kernel.msgmnb = 16384  -->/* default max size of a message queue */
kernel.msgmni = 16     -->/* max # of msg queue identifiers */
kernel.msgmax = 8192   -->/* max size of message (bytes) */ 

또한 현재 사용중인 msg queue관련 정보는 다음 명령으로 확인 가능합니다.
$> ipcs -q

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages    
0x00000007 0          root       666        0            0           
0x00000005 32769      root       666        0            0           
0x0000000b 65538      root       666        0            0 
  

return = msgget( arMSQ_key[i], 0 ); 

에서 msgget의 2번째 인자는 (IPC_CREAT ,IPC_EXCL ,IPC_NOWAIT) 과 퍼미션(ex-0666)의 '|'연산으로 사용했던거 같은데.. 0 입력시의 결과는 어찌되는지 모르겠네요...
몇년전에 msg queue를 사용해서 풀그림을 했었는데 이렇게 많은수의 큐를 사용하지 않았기 때문에 그냥 짐작가는 곳을 찍어봤습니다.

man ipcs
man ipcrm
man sysctl
...

nahanjang의 이미지

위에 글 쓴이인데요...
근데 큐를 검사 한다는게 무슨뜻인지 ?
보통 msgget은 메시지 큐를 생성하거나 또는 이미 생성된 메시지 큐에 접속하여 해당 msg queue id를 찾고 msgsnd 나 msgrcv로 송수신 하고 msgctl로 제어하는 식으로 사용하는걸루 아는데 ...

Quote:

아 네 맞습니다.
그리고 간략화...주석지운게 다입니다.

이게 맞다면 좀 이상한거 같아서... ㅎㅎ

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.