Unhandled exception. System.IO.IOException: The configured user limit (128) on the number of inotify instances 处理

发布时间 2023-12-13 15:07:01作者: MhaiM

现象:Unhandled exception. System.IO.IOException: The configured user limit (128) on the number of inotify instances has been reached, or the per-process limit on the number of open file descriptors has been reached. at System.IO.FileSystemWatcher.StartRaisingEvents()

1、分析原因:

在DotNet核心中读取json文件时出错“已达到inotify实例数量的配置用户限制(128)

2、处理方法

cat /proc/sys/fs/inotify/max_user_instances 查看原来的默认128

vim /etc/sysctl.conf 添加如下内容

fs.inotify.max_user_watches = 1638400
fs.inotify.max_user_instances = 1638400

使配置生效 sysctl -p

再次查看 cat /proc/sys/fs/inotify/max_user_instances 变成1638400了