khoj-ai / khoj

Your AI second brain. Get answers to your questions, whether they be online or in your own notes. Use online AI models (e.g gpt4) or private, local LLMs (e.g llama3). Self-host locally or use our cloud instance. Access from Obsidian, Emacs, Desktop app, Web or Whatsapp.
https://khoj.dev
GNU Affero General Public License v3.0
12.63k stars 640 forks source link

[FIX] bug get q too long cause this bug #899

Closed thinker007 closed 1 week ago

thinker007 commented 3 weeks ago

get q too long cause this bug:

uvicorn.error: Invalid HTTP request h11_impl.py:132 received.
╭─ Traceback (most recent call last─╮
│ /usr/local/lib/python3.10/dist-pa │
│ ckages/uvicorn/protocols/http/h11 │
│ _impl.py:129 in handle_events │
│ │
│ 126 │ def handle_events(self) │
│ 127 │ │ while True: │
│ 128 │ │ │ try: │
│ ❱ 129 │ │ │ │ event = sel │
│ 130 │ │ │ except h11.Remo │
│ 131 │ │ │ │ msg = "Inva │
│ 132 │ │ │ │ self.logger │
│ │
│ /usr/local/lib/python3.10/dist-pa │
│ ckages/h11/_connection.py:476 in │
│ next_event │
│ │
│ 473 │ │ │ │ if len(self │
│ 474 │ │ │ │ │ # 431 i │
│ 475 │ │ │ │ │ # much │
│ ❱ 476 │ │ │ │ │ raise R │
│ 477 │ │ │ │ │ │ "Re │
│ 478 │ │ │ │ │ ) │
│ 479 │ │ │ │ if self._re │
╰───────────────────────────────────╯
RemoteProtocolError: Receive buffer
too long

try to increase max_incomplete_event_size which default is 16*1024 should resolve this bug

thinker007 commented 3 weeks ago

get fixed by uvicorn.run( app, host=host, port=port, log_level="debug" if state.verbose > 1 else "info", use_colors=True, log_config=None, timeout_keep_alive=60, h11_max_incomplete_event_size = 1024*1024, )

and you have to upgrade uvicorn to latest version

debanjum commented 2 weeks ago

Hey @thinker007, thanks for raising this issue and a fix for it!

Do you mind sharing what kind of questions you're asking that result in >16Kb payload (and trigger this issue)?