• SupportuWSGI
  • UWSGI keeps file descriptor to deleted file open

Hi There,
when I do "lsof +L1", I see a lot of entries of uwsgi holding file descriptor open for deleted file. Looks like this happens during log rotation. but in uwsgi command i have --log-maxsize option enabled which supposedly should close all file descriptors to old log. Any help is appreciated!
below is how uwsgi is configured:
uwsgi \
--http 0.0.0.0:42595 \
--logto /var/log/appformix/manager/uwsgi.log \
--log-maxsize 10485760 \
--enable-threads \
--limit-post ${APPFORMIX_AGENT_MAX_PAYLOAD_SIZE} \
-w appformix_manager:host_server

output of lsof +L1
uwsgi 204904 root 3u REG 252,2 10485949 0 2340435014 /var/log/appformix/uwsgi.log.1 (deleted)
uwsgi 204914 root 3u REG 252,2 10485949 0 2340435014 /var/log/appformix/uwsgi.log.1 (deleted)
uwsgi 204922 root 3u REG 252,2 10485949 0 2340435014 /var/log/appformix/uwsgi.log.1 (deleted)
uwsgi 204931 root 3u REG 252,2 10485949 0 2340435014 /var/log/appformix/uwsgi.log.1 (deleted)
uwsgi 204944 root 3u REG 252,2 10485949 0 2340435014 /var/log/appformix/uwsgi.log.1 (deleted)
uwsgi 204952 root 3u REG 252,2 10485949 0 2340435014 /var/log/appformix/uwsgi.log.1 (deleted)

  • sean replied to this.

    kunal since you are logging to /var/log/appformix/manager/uwsgi.log and not to a location within your Opalstack shell user home directory I'm going to assume that you are not running your project on Opalstack's services. If you were, we would rotate your logs for you automatically in your shell user's home directory.

    It looks like you have root access to your system so my recommendation is that you remove --log-maxsize from your run command and instead use logrotate to manage your logs. There is an example at: https://superuser.com/questions/867857/uwsgi-how-to-keep-log-file-size-contained

    Mastodon