khoj-ai / khoj

Your AI second brain. Self-hostable. Get answers from the web or your docs. Build custom agents, schedule automations, do deep research. Turn any online or local LLM into your personal, autonomous AI (e.g gpt, claude, gemini, llama, qwen, mistral).
https://khoj.dev
GNU Affero General Public License v3.0
14.77k stars 735 forks source link

Initialization fails after running out of disk space #369

Closed link2xt closed 1 year ago

link2xt commented 1 year ago

I have configured some folder with org files for search and khoj process started to download models from huggingface. Now this partially downloaded model causes error messages:

                    OSError: .../.khoj/search/image/sentence-transformers_clip-ViT-B-32 does not appear to have a file named config.json.

Web UI says "Unable to reinitialize. Raise issue on Khoj Github or Discord.".

I will remove .khoj and restart from scratch.

sabaimran commented 1 year ago

Interesting -- were you unblocked if you cleared some of your disk space?

Agreed that's not a pleasant experience. Ideally it would rollback partial writes if it failed in the middle, but this might be difficult if it just ends up hanging in the middle.

link2xt commented 1 year ago

Yes, it works after removing .khoj and reconfiguring from scratch.

Agreed that's not a pleasant experience. Ideally it would rollback partial writes if it failed in the middle, but this might be difficult if it just ends up hanging in the middle.

I think the correct way to do this is to download into a temporary directory nearby (on the same filesystem, not in /tmp) like .khoj/download and only if there are no errors rename/move it into place. Then remove .khoj/download each time on start to garbage-collect previously failed downloads.

sabaimran commented 1 year ago

That's a wonderful suggestion. That will definitely be helpful for our codepath that downloads llamav2 as well -- it's a massive 3.6GB file with some propensity to failure.

debanjum commented 1 year ago

This was resolved in #393