리눅스 메시지큐 관련해서 질문 있습니다.

ljs0766의 이미지

안녕하세요?
지금 프로젝트를 진행하다 요상한 문제가 발견이 되어서 질문드립니다.

상황은

Process A -> Process B : TCP 통신

Process B -> Process C : 메시지큐 통신

이런식으로 통신이 이루어지고 있고
Process A가 1초 주기로 메시지를 Process B에게 전달해주고 Process B는 Process C에게 해당 메시지를 전달 해주는
일을 합니다. Process C는 메시지를 받아서 무언가를 처리하고 Process A에게 처리완료 메시지를 Process B에게 전달해주면
Process B는 Process A에게 처리 완료 메시지를 전달합니다.

이때 문제가...Process C에서 msgsnd 함수로 처리 완료 메시지를 보내고 성공을 하는데
정작 Process B에서는 msgrcv 함수를 이용하여 읽을 때 Process C가 보낸 메시지가 오지 않는 경우가 생깁니다.
지금껏 메시지큐를 이용했을 때 이런 경우가 없었는데 참 난감합니다.

혹시 이런 일 겪으신분 이나 해결책을 알고 계신분 있으시면 도움 좀 부탁드립니다.

mirr187의 이미지

확인해 봐야 할게...

1. 현재 message queue에 쌓여 있는 메시지의 개수 (또는 크기)
2. process C에서 send 성공 이후 message 개수와, last send pid
3. message queue에 message의 개수가 줄어들었다면, last recv pid 를 확인
4. 줄어들지 않았다면, C 와 B에서 사용하는 msgbuf의 mtype을 확인

대충 요정도를 확인하시면 문제점이 뭐였는지 확인 가능할겁니다...

ps. lspid, lrpid(last send pid, last, recv pid)는 ipcs 로 확인하시면 됩니다...

linux에서는 ipcs -qt 로 queue의 사용 시간을 확인하고 ipcs -qp 로 pid 확인 가능하고, solaris에서는 ipcs -aq로 확인 가능합니다.

ljs0766의 이미지

시스템에서 메시지큐 쓰는 프로세스가 제가 작성한 프로세스만 있는 줄 알았는데..

다른사람이 작성한 프로세스에서 메시지큐를 읽어가더군요..

도둑질 당했습니다...ㅠ.ㅠ

이글 올리고 바로 인터넷 연결이 끊어져서..뭐 이래저래 찾아보다가

mirr187님이 알려주신 방법으로 금방 해결봤습니다...

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.