How can I tell if I am out of inotify watches?

Jorge Castro

I use an application that consumes inotify watches. I've already set

fs.inotify.max_user_watches=32768

in /etc/sysctl.conf but last night the application stopped indexing unless I ran it manually, which leads me to suspect I am out of watches.

Since I don't know what the trade off is when I increase this number (does it consume more RAM?), I don't know if I should just increase this number, so I'd like to know if there's a way I can tell if it's using all these watches and what the tradeoffs might be for increasing it.

ish

How do you know if you are out of watches? tail will tell!

  • Start tail with the -f (follow) option on any old file, e.g. tail -f /var/log/dmesg:
    • If all is well, it will show the last 10 lines and pause; abort with Ctrl-C
    • If you are out of watches, it will fail with this somewhat cryptic error:
      tail: cannot watch '/var/log/dmsg': No space left on device

For the curious: Why is tail a "telltail"?

  • Actually, any well-written app should have the courtesy of telling you, since the inotify API/calls clearly tells them what the deal is.
  • Try strace tail -f ... instead, and when it succeeds, it ends with:
    inotify_add_watch(4, "/var/log/dmesg", IN_MODIFY...) = 1
    
  • 그러나 실패하는 경우, 즉 시계가 부족하면 다음과 같이 표시됩니다 .
    inotify_add_watch (4, "/ var / log / dmesg", IN_MODIFY ..)
     = -1 ENOSPC (장치에 남은 공간 없음)
    

시계를 늘릴 수 있습니까? 얼마나? 트레이드 오프가 있습니까?

짧은 대답 : 물론입니다. 원하는 경우 50 만 (524288)으로 곧바로 이동하십시오 ... 사용되는 추가 메모리 는 4GB 이상의 메모리가있는 최신 시스템에서 무시 해도 됩니다.

  • 사용 된inotify 시계는 540 바이트 (32 비트 시스템) 또는 1kB (64 비트에서 이중)를 차지합니다. [출처 : 1 , 2 ]
  • 이것은 스왑 할 수없는 커널 메모리 에서 나옵니다 .
  • So, assuming you set the max at 524288, and all were used (improbable), you'd be using approx. 256MB/512MB of 32-bit/64-bit kernel memory

    • Note that your application will also use additional memory to keep track of the inotify handles, file/directory paths, etc. -- how much depends on its design.
  • What's the max value? I guess none, in theory, as long as you have enough RAM. In practice, 524288 has been officially recommended by apps, and people have been setting it to 2 million, with the accompanying memory usage, of course.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How can I tell which user limit I am running into?

분류에서Dev

How can I monitor the device's audio output to be able to tell if sound is coming out of the speakers/headphone jack?

분류에서Dev

How can I tell if a machine has PAE?

분류에서Dev

How can I tell a function enters kernel or not

분류에서Dev

How can I tell what version of Linux I'm using?

분류에서Dev

How can I tell my python script to wait for the "save as" dialogue box to pop out in chrome before executing the next block of the code?

분류에서Dev

How can I tell how many bits my ssh key is?

분류에서Dev

How can I programmatically tell if a filename matches a shell glob pattern?

분류에서Dev

How can I tell django 1.7 to put migration into specific folder

분류에서Dev

How can I tell what process is unmounting a file system?

분류에서Dev

How can I tell if my hard drive is PATA or SATA?

분류에서Dev

How can I tell the version of a package which will be installed before I install it?

분류에서Dev

Can I keep . and .. out of .* expansion?

분류에서Dev

How can I find out which Git commits cause conflicts?

분류에서Dev

How can I pass the stringbuilder and display out in another class

분류에서Dev

How can I strip out all HTML from my string

분류에서Dev

How can I find out whether a HTML-Tagname is Standalone

분류에서Dev

How can I built a basic graph out of this data?

분류에서Dev

How can I strip out urls from a string in MySQL?

분류에서Dev

How can I print out session message in Laravel?

분류에서Dev

How can I simulate a Bezier curve out of an image?

분류에서Dev

How can I tell if handleOpenURL is called app startup or while app is running?

분류에서Dev

How can I tell when a Layout (and all its child Views) has fully finished inflating?

분류에서Dev

Under Linux, how can I tell the real power consumed by a usb device

분류에서Dev

How can I tell data arrives on a HTTP keep-alive connection?

분류에서Dev

How can I tell if my Cordova application is running on a simulator or real device?

분류에서Dev

In C++, how can I tell WHICH piece of code is allocating what TYPE of objects?

분류에서Dev

How can I tell if the wireless network card in my laptop supports 802.11n?

분류에서Dev

How can I tell if someone is a friend of mine in Facebook Graph API V2.0 and above?

Related 관련 기사

  1. 1

    How can I tell which user limit I am running into?

  2. 2

    How can I monitor the device's audio output to be able to tell if sound is coming out of the speakers/headphone jack?

  3. 3

    How can I tell if a machine has PAE?

  4. 4

    How can I tell a function enters kernel or not

  5. 5

    How can I tell what version of Linux I'm using?

  6. 6

    How can I tell my python script to wait for the "save as" dialogue box to pop out in chrome before executing the next block of the code?

  7. 7

    How can I tell how many bits my ssh key is?

  8. 8

    How can I programmatically tell if a filename matches a shell glob pattern?

  9. 9

    How can I tell django 1.7 to put migration into specific folder

  10. 10

    How can I tell what process is unmounting a file system?

  11. 11

    How can I tell if my hard drive is PATA or SATA?

  12. 12

    How can I tell the version of a package which will be installed before I install it?

  13. 13

    Can I keep . and .. out of .* expansion?

  14. 14

    How can I find out which Git commits cause conflicts?

  15. 15

    How can I pass the stringbuilder and display out in another class

  16. 16

    How can I strip out all HTML from my string

  17. 17

    How can I find out whether a HTML-Tagname is Standalone

  18. 18

    How can I built a basic graph out of this data?

  19. 19

    How can I strip out urls from a string in MySQL?

  20. 20

    How can I print out session message in Laravel?

  21. 21

    How can I simulate a Bezier curve out of an image?

  22. 22

    How can I tell if handleOpenURL is called app startup or while app is running?

  23. 23

    How can I tell when a Layout (and all its child Views) has fully finished inflating?

  24. 24

    Under Linux, how can I tell the real power consumed by a usb device

  25. 25

    How can I tell data arrives on a HTTP keep-alive connection?

  26. 26

    How can I tell if my Cordova application is running on a simulator or real device?

  27. 27

    In C++, how can I tell WHICH piece of code is allocating what TYPE of objects?

  28. 28

    How can I tell if the wireless network card in my laptop supports 802.11n?

  29. 29

    How can I tell if someone is a friend of mine in Facebook Graph API V2.0 and above?

뜨겁다태그

보관