Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 8 of 8
  1. #1
    Senior Member JJZolx's Avatar
    Join Date
    Apr 2005
    Location
    Colorado
    Posts
    11,581

    SbS 7.6 inotify: What are max_user_watches?

    I see this entry in my 7.6 server log on Ubuntu:

    Code:
    [10-05-17 02:04:52.0743] Slim::Utils::AutoRescan::Linux::canWatch (75) inotify init, max_user_watches: 8192
    If watches are set up per directory and traditionally most people have one directory per album (as well as artist and sometimes genre directories), then would this mean that there's a limit of 8192 albums for autoscanning?

    I plan on running multiple instances of SbS 7.6 on the server (not using virtual machines). Can more than one process be subscribed to the notifies from the same directories, or would each process set up separate watches so that the 8192 would be shared by all servers?

  2. #2
    Senior Member snarlydwarf's Avatar
    Join Date
    Jul 2005
    Location
    Oregon
    Posts
    3,674
    Quote Originally Posted by JJZolx View Post
    If watches are set up per directory and traditionally most people have one directory per album (as well as artist and sometimes genre directories), then would this mean that there's a limit of 8192 albums for autoscanning?

    I plan on running multiple instances of SbS 7.6 on the server (not using virtual machines). Can more than one process be subscribed to the notifies from the same directories, or would each process set up separate watches so that the 8192 would be shared by all servers?
    As root:
    echo 16384 > /proc/sys/fs/inotify/max_user_watches

    Magic.

  3. #3
    Senior Member snarlydwarf's Avatar
    Join Date
    Jul 2005
    Location
    Oregon
    Posts
    3,674
    Oh and according to http://www.linuxinsight.com/proc_sys...r_watches.html this limit is per inotify instance.

    So it probably won't affect many people at all.

    /proc/sys/filesystem/inotify/max_user_instances is the maximum number of inotify instances that a given user can instantiate. The default value is 128 instances, per user.

    /proc/sys/filesystem/inotify/max_user_watches is the maximum number of watches per instance. The default value is 8,192 watches, per instance.
    So, yeah, it reads like 8k would be per server.

    If it's not enough, change it with sysctl or echo.

  4. #4
    Senior Member JJZolx's Avatar
    Join Date
    Apr 2005
    Location
    Colorado
    Posts
    11,581
    Quote Originally Posted by snarlydwarf View Post
    As root:
    echo 16384 > /proc/sys/fs/inotify/max_user_watches
    Thanks. What will happen when someone with more than 8192 subdirectories in their music folder uses 7.6 without making this adjustment?

  5. #5
    Senior Member JJZolx's Avatar
    Join Date
    Apr 2005
    Location
    Colorado
    Posts
    11,581
    Quote Originally Posted by snarlydwarf View Post
    Oh and according to http://www.linuxinsight.com/proc_sys...r_watches.html this limit is per inotify instance.

    So it probably won't affect many people at all.
    What's an 'instance' of inotify? Would one SbS server create just one instance? That would still leave a limit of 8192 watches for the server, wouldn't it?

  6. #6
    Senior Member snarlydwarf's Avatar
    Join Date
    Jul 2005
    Location
    Oregon
    Posts
    3,674
    Quote Originally Posted by JJZolx View Post
    What's an 'instance' of inotify? Would one SbS server create just one instance? That would still leave a limit of 8192 watches for the server, wouldn't it?
    Yes, an instance is basically a file handle: I guess if SBS really cared, it could create multiple instances, each with 8k watches.

    There is a peruser limit (by default, 128 instances), and a per-instance limit of things to watch (by default, 8k). I believe SBS is just watching the directories, not the files in them (which makes sense: watching the directory would get additions and deletes, though not always changes... which is why it seems I need to rename things after updating tags).

    So 8k directories is a ton and should be plenty sufficient.

    Those with huge libraries would benefit from adding a line to /etc/sysctl.conf:

    fs.inotify.max_user_watches = 16384

  7. #7
    Senior Member JJZolx's Avatar
    Join Date
    Apr 2005
    Location
    Colorado
    Posts
    11,581
    Quote Originally Posted by snarlydwarf View Post
    I believe SBS is just watching the directories, not the files in them (which makes sense: watching the directory would get additions and deletes, though not always changes... which is why it seems I need to rename things after updating tags).
    Isn't it supposed to catch changes to files within a directory? If not, how does the Touch work? Do you have to do these renaming tricks or a 'wipe and rescan' every time you modify a file?

  8. #8
    Senior Member snarlydwarf's Avatar
    Join Date
    Jul 2005
    Location
    Oregon
    Posts
    3,674
    Quote Originally Posted by JJZolx View Post
    Isn't it supposed to catch changes to files within a directory? If not, how does the Touch work? Do you have to do these renaming tricks or a 'wipe and rescan' every time you modify a file?
    It seems to be watching directories, so it would get files added/deleted events (since those are actually changes to the directory as well), and renames (again a change to the directory).

    It doesn't seem to be getting file changes themselves (ie, updating tags within a file) since that isn't a change to the directory, but a change to the file, which doesn't alter the directory at all.

    Most of the time you can add/delete/modify tags in a file and not have to rewrite the whole file (which is a create/delete/rename sort of operation) since id3 and vorbis tags try to avoid forcing a full rewrite if they can.

    Renaming a file does generate an event on the directory.

    I am back to doing a full rescan nightly for the moment because SBS doesn't "re-merge" albums correctly, but that's another bug. It also does not seem to pick up added album art via inotify updates, and since I'm on a "lets track down obscure art" binge, that gets annoying.

    (Ie, create an album with two tracks, each with a different album name... let the scanner pick up the two albums... correct the album name to be consistent on both tracks, and they won't get merged back together but will stay as two distinct albums even though they have the same name and are in the same directory. Only a full scan fixes that.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •