My problem was with nested async. I needed to comment out that import:
# nest_asyncio.apply()
It looked like a memory issue but in my logs for the jupyter service it was clear that it was async issue:
`
sudo systemctl status jupyter
[sudo] password for demo:
● jupyter.service - Jupyter-Notebook Daemon
Loaded: loaded (/etc/systemd/system/jupyter.service; enabled; preset: enabled)
Active: active (running) since Mon 2025-06-30 01:57:29 UTC; 37min ago
Main PID: 1204921 (jupyter-noteboo)
Tasks: 16 (limit: 153561)
Memory: 150.0M (peak: 220.6M)
CPU: 24.173s
CGroup: /system.slice/jupyter.service
├─1204921 /home/demo/jupyter_env/bin/python3 /home/demo/jupyter_env/bin/jupyter-notebook --no-browser --notebook-dir=/home/demo
└─1218765 /home/demo/rag/bin/python -Xfrozen_modules=off -m ipykernel_launcher -f /home/demo/.local/share/jupyter/runtime/kernel-c293a975-19f7-443a-801b-00>
Jun 30 02:30:51 demo bash[1218711]: File "/usr/lib/python3.12/asyncio/base_events.py", line 1972, in _run_once
Jun 30 02:30:51 demo bash[1218711]: handle = self._ready.popleft()
Jun 30 02:30:51 demo bash[1218711]: ^^^^^^^^^^^^^^^^^^^^^