BridgeGate log has Too many open files Exception

If you encounter a (Too many open files) Exception in the /bridgegate/logs/server.log log file on a Linux system your system administrator will need to increase the number of OS File Descriptors the bridgegate process is allowed to use.

  1.  To increase edit /etc/sysctl.conf add the below line, save and exit
    fs.file-max = 100000
  2. We also need to increase hard and soft limits
    Edit /etc/security/limits.conf add the below lines before the #End, save and exit

    * soft nofile 65535
    * hard nofile 65535
  3. Edit the bridgegate service, vi/etc/systemd/system/bridgegate.service  and add the below  line at the of the [Service] section, save and exit
  4. Reload systemctl to apply new setting
    sudo systemctl daemon-reload
  5. Restart the bridgegate service
    sudo systemctl restart bridgegate
  6. Check the file limits of the bridgegate process. First find the process id for the bridgegate process
    ps -ef | grep java
    The output will look like the following. The process id is the first number after the bgate
    bgate    27919 27854 94 10:03 ?        00:18:59 /usr/java/jdk1.8.0_191-amd64/bin/java 
    -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 
    -XX:+UseStringDeduplication -DBRIDGEGATE_ROOT=/bridgegate -DBRIDGEGATE_SERVER=true -Xms1g -Xmx20g -XX:+UseG1GC -XX:NewRatio=1 
    -XX:ErrorFile=/bridgegate/logs/java_error%p.log -Dlog4j.configuration=file:/bridgegate/conf/log4j.xml 
    -Djava.util.logging.config.file=/bridgegate/server/conf/ -Dignore.endorsed.dirs= 
    -classpath /bridgegate/server/bin/bootstrap.jar:/bridgegate/server/bin/tomcat-juli.jar -Dcatalina.base=/bridgegate/server 
    -Dcatalina.home=/bridgegate/server org.apache.catalina.startup.Bootstrap start

    Next view the limits for that process id

    cat /proc/27919/limits
    Limit                     Soft Limit           Hard Limit           Units     
    Max cpu time              unlimited            unlimited            seconds   
    Max file size             unlimited            unlimited            bytes     
    Max data size             unlimited            unlimited            bytes     
    Max stack size            8388608              unlimited            bytes     
    Max core file size        0                    unlimited            bytes     
    Max resident set          unlimited            unlimited            bytes     
    Max processes             126055               126055               processes 
    Max open files            65535                65535                files     
    Max locked memory         65536                65536                bytes     
    Max address space         unlimited            unlimited            bytes     
    Max file locks            unlimited            unlimited            locks     
    Max pending signals       126055               126055               signals   
    Max msgqueue size         819200               819200               bytes     
    Max nice priority         0                    0                    
    Max realtime priority     0                    0                    
    Max realtime timeout      unlimited            unlimited            us