openimsdk / open-im-server

IM Chat
https://openim.io
Apache License 2.0
13.89k stars 2.44k forks source link

Excessive File Watchers Cause "too many open files" Error in openimserver-openim-push and openimserver-openim-rpc-friend Pods #1156

Closed cubxxw closed 7 months ago

cubxxw commented 12 months ago

Body:

Description

When monitoring the logs of the openimserver-openim-push and openimserver-openim-rpc-friend pods, the following error was encountered after the service started:

failed to create fsnotify watcher: too many open files

The error seems to be related to reaching the maximum file watchers limit.

Logs

For openimserver-openim-push pod:

configFolderPath: use config ../config/config.yaml use config ../config/notification.yaml PortFromConfig: port PortFromConfig: prometheus_port start openimserver-openim-push server, port: 80 prometheusPort: 0 , OpenIM version: v3.2.0 failed to create fsnotify watcher: too many open files

And for openimserver-openim-rpc-friend pod:

configFolderPath: use config ../config/config.yaml use config ../config/notification.yaml PortFromConfig: port PortFromConfig: prometheus_port start openimserver-openim-rpc-friend server, port: 80 prometheusPort: 0 , OpenIM version: v3.2.0

Workaround

The issue was temporarily mitigated by increasing the system file watcher limits with the following commands:

sudo sysctl -w fs.inotify.max_user_watches=2099999999
sudo sysctl -w fs.inotify.max_user_instances=2099999999
sudo sysctl -w fs.inotify.max_queued_events=2099999999

However, this might not be a sustainable solution, especially in environments with multiple running pods/services. It is critical to understand why so many files are being watched and whether optimizations can be applied to reduce the number.

Environment

Expected Behavior

The services/pods should run without encountering the "too many open files" error and without requiring modifications to system-level file watcher settings.

Potential Solutions

kubbot commented 10 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

cubxxw commented 10 months ago

restart

kubbot commented 7 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

kubbot commented 7 months ago

This issue was closed because it has been stalled for 7 days with no activity.