대량의 io가 발생하는 환경에서 read 가 실패할경우 예외처리.

송파구최고존엄의 이미지

안녕하세요 file i/o에 문제가 생겨서 문의차 글올려봅니다.

현재 리눅스환경에서 fanotify 를 이용하여 파일 정보를 수집중입니다.

평상시에는 괜찮다가 파일 io가 대량으로 수행이 되면 (예, while(1) echo "1123"~~ 반복하는 쉘스크립트 실행)

read가 실패하더군요 그래서 실패할경우 for문으로 10번정도 반복시도 하면서 usleep 10000정도를 주고 재시도를 해봤는데 결국 똑같이 10번 실패를 합니다.

혹시 이러한 경우 예외처리를 어떻게 해야하는지 궁금합니다.

fd를 닫았다가 다시열면 괜찮을까요 ?

Hodong Kim@Google의 이미지

fanotify 에 대해 잘 모르는데,
메뉴얼을 보니, http://man7.org/linux/man-pages/man7/fanotify.7.html
에러들이 있습니다. 아마 그에 대해 처리해야 하지 않을까요?

       In addition to the usual errors for read(2), the following errors can
       occur when reading from the fanotify file descriptor:
 
       EINVAL The buffer is too small to hold the event.
 
       EMFILE The per-process limit on the number of open files has been
              reached.  See the description of RLIMIT_NOFILE in
              getrlimit(2).
 
       ENFILE The system-wide limit on the total number of open files has
              been reached.  See /proc/sys/fs/file-max in proc(5).
 
       ETXTBSY
              This error is returned by read(2) if O_RDWR or O_WRONLY was
              specified in the event_f_flags argument when calling
              fanotify_init(2) and an event occurred for a monitored file
              that is currently being executed.
 
       In addition to the usual errors for write(2), the following errors
       can occur when writing to the fanotify file descriptor:
 
       EINVAL Fanotify access permissions are not enabled in the kernel
              configuration or the value of response in the response
              structure is not valid.
 
       ENOENT The file descriptor fd in the response structure is not valid.
              This may occur when a response for the permission event has
              already been written.
chocokeki의 이미지

송최존님 혹시 errno가 뭔지 알 수 있나요?

송파구최고존엄의 이미지

9 BAd Descp~~ 나옵니다.

댓글 달기

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