Hi, I'm experiencing a memory leak issue intermittently, and I haven't identified the root cause yet. To address this, I plan to create a daily cron job to restart my Python Gunicorn application, refreshing its memory usage.
I attempted to use the command provided in the following link: https://www.aapanel.com/forum/d/15363-restart-pythondjango-service-via-cli
When using the command:
/etc/init.d/aaa _pymanager restart
The CLI returns:
!!! WARNING: the configuration file should have a valid Python extension. !!!
However, when using:
systemctl restart aaa _pymanager
It appears to work, and checking the Gunicorn application log shows:
[INFO] Starting gunicorn 20.0.4
However, this method doesn't reset the current memory usage of my application.
In contrast, when manually restarting it using the "restart" button, the application fully restarts, as evident in the log:
[INFO] Parent changed, shutting down: <Worker 1923875>
[INFO] Worker exiting (pid: 1923875)
[INFO] Starting gunicorn 20.0.4
[INFO] Listening at: http://0.0.0.0:2009 (1937163)
[INFO] Using worker: geventwebsocket.gunicorn.workers.GeventWebSocketWorker
[INFO] Booting worker with pid: 1937163
[INFO] Booting worker with pid: 1937163
[INFO] Booting worker with pid: 1937163
[INFO] Starting gunicorn 20.0.4
This time, my applications memory usage refreshes when using the "restart" button.
My goal is to replicate the effect of the "restart" button through a cron job script.