Adapter agent is failed to start with error "User limit of inotify instances reached or too many open files"

Adapter agent is failed to start with error "User limit of inotify instances reached or too many open files"

book

Article ID: KB0078840

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix Adapter Framework 1.3.x,1.4.x

Description

Adapter agent is failed to start with following error,
===========
17:23:02.990 [/opt/tibco/afx/1.3/config/adapteragent.ini watcher] ERROR c.t.b.t.m.c.PropertiesFileMonitor - failed to setup watcher for /opt/tibco/afx/1.3/config/adapteragent.ini
java.io.IOException: User limit of inotify instances reached or too many open files
        at sun.nio.fs.LinuxWatchService.<init>(LinuxWatchService.java:64) ~[na:1.8.0_121]
        at sun.nio.fs.LinuxFileSystem.newWatchService(LinuxFileSystem.java:47) ~[na:1.8.0_121]
        at com.tibco.bw.thor.management.common.PropertiesFileMonitor$1.run(PropertiesFileMonitor.java:73) ~[com.tibco.adapter.management.common_1.1.100.006.jar:na]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]
tail: inotify cannot be used, reverting to polling: Too many open files
===========
This is error occurred due to the upper limit on the number of inotify instances has been reached.At the OS kernel level having the inotify API which provides a mechanism for monitoring individual files or directories and which contains the max_user_instances interface that is used to limit the amount of kernel memory instance consumed by inotify.

Issue/Introduction

Adapter agent is failed to start with error "User limit of inotify instances reached or too many open files"

Environment

Product: TIBCO ActiveMatrix Adapter Framework Version 1.3.x,1.4.x OS: Linux

Resolution

To resolve this issue execute below commands :

1)Check current value of max_user_instances:
$ cat /proc/sys/fs/inotify/max_user_instances

2)increase that value:
$ echo 256 > /proc/sys/fs/inotify/max_user_instances

3)In order to make that change permanent add a line to /etc/sysctl.conf:
fs.inotify.max_user_instances = 256

Additional Information

https://stackoverflow.com/questions/32281277/too-many-open-files-failed-to-initialize-inotify-the-user-limit-on-the-total