about summary refs log tree commit homepage
path: root/lib/PublicInbox/DirIdle.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-03-28 11:12:36 +0000
committerEric Wong <e@80x24.org>2023-03-29 04:36:42 +0000
commit687f579ab401cc9ddf63e9901c37c37ab7d4eef1 (patch)
treed694b635940db1239109eaabc2268813c8e84e1b /lib/PublicInbox/DirIdle.pm
parent6061f4e7b3c68bb4f41960c4df2c1eddcbdc86d9 (diff)
downloadpublic-inbox-687f579ab401cc9ddf63e9901c37c37ab7d4eef1.tar.gz
As encountered by Louis DeLosSantos, Linux inotify is capped by
a lesser-known limit than the standard RLIMIT_NOFILE (`ulimit -n`)
value.  Give the user a hint about the fs.inotify.max_user_instances
sysctl knob on EMFILE, since EMFILE alone may mislead users into
thinking they've hit the (typically higher) RLIMIT_NOFILE limit.

I can test this on my system using:

  perl -I lib -MPublicInbox::Inotify -E \
   'my @x = map { PublicInbox::Inotify->new } (1..128)'

But I hesitate to include it in the test suite since triggering
the limit can cause unrelated processes to fail.

Link: https://public-inbox.org/meta/CAE6jdTo8iQfNM9Yuk0Dwi-ARMxmQxX-onL8buXcQ9Ze3r0hKrg@mail.gmail.com/
Reported-by: Louis DeLosSantos <louis.delos@gmail.com>
Diffstat (limited to 'lib/PublicInbox/DirIdle.pm')
-rw-r--r--lib/PublicInbox/DirIdle.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/DirIdle.pm b/lib/PublicInbox/DirIdle.pm
index 55c3982f..af99811c 100644
--- a/lib/PublicInbox/DirIdle.pm
+++ b/lib/PublicInbox/DirIdle.pm
@@ -9,14 +9,14 @@ use PublicInbox::Syscall qw(EPOLLIN);
 use PublicInbox::In2Tie;
 
 my ($MAIL_IN, $MAIL_GONE, $ino_cls);
-if ($^O eq 'linux' && eval { require Linux::Inotify2; 1 }) {
+if ($^O eq 'linux' && eval { require PublicInbox::Inotify; 1 }) {
         $MAIL_IN = Linux::Inotify2::IN_MOVED_TO() |
                 Linux::Inotify2::IN_CREATE();
         $MAIL_GONE = Linux::Inotify2::IN_DELETE() |
                         Linux::Inotify2::IN_DELETE_SELF() |
                         Linux::Inotify2::IN_MOVE_SELF() |
                         Linux::Inotify2::IN_MOVED_FROM();
-        $ino_cls = 'Linux::Inotify2';
+        $ino_cls = 'PublicInbox::Inotify';
 # Perl 5.22+ is needed for fileno(DIRHANDLE) support:
 } elsif ($^V ge v5.22 && eval { require PublicInbox::KQNotify }) {
         $MAIL_IN = PublicInbox::KQNotify::MOVED_TO_OR_CREATE();