Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@leseb
Copy link
Contributor

@leseb leseb commented Mar 14, 2024

The chat was abruptly failing with the following stack trace if the chat is answering and the server crashes during that time:

lab chat

╭──────────────────────────────────────────────────────────────────── system ────────────────────────────────────────────────────────────────────╮
│ Welcome to Chat CLI w/ MERLINITE-7B-Q4_K_M (type /h for help)                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
>>>                                                                                                                                   [S][default]
>>> hello                                                                                                                             [S][default]
╭───────────────────────────────────────────────────────────── merlinite-7b-Q4_K_M ──────────────────────────────────────────────────────────────╮
│ Hello! I'm here to                                                                                                                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── elapsed 1.031 seconds ─╯
Traceback (most recent call last):
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exceptions
    yield
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpx/_transports/default.py", line 113, in __iter__
    for part in self._httpcore_stream:
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 367, in __iter__
    raise exc from None
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 363, in __iter__
    for part in self._stream:
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpcore/_sync/http11.py", line 349, in __iter__
    raise exc
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpcore/_sync/http11.py", line 341, in __iter__
    for chunk in self._connection._receive_response_body(**kwargs):
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpcore/_sync/http11.py", line 210, in _receive_response_body
    event = self._receive_event(timeout=timeout)
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpcore/_sync/http11.py", line 220, in _receive_event
    with map_exceptions({h11.RemoteProtocolError: RemoteProtocolError}):
  File "/usr/lib64/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.RemoteProtocolError: peer closed connection without sending complete message body (incomplete chunked read)

Now we handle this more elagantly and print before exiting:

lab chat
╭──────────────────────────────────────────────────────────────────── system ────────────────────────────────────────────────────────────────────╮
│ Welcome to Chat CLI w/ MERLINITE-7B-Q4_K_M (type /h for help)                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
>>> hello                                                                                                                             [S][default]
Connection to the server was closed
Executing chat failed with: API issue found while executing chat: Connection to the server was closed

DO NOT MERGE - DEPENDS ON: #613

@leseb leseb force-pushed the gentle-chat-error-on-server-shutdown branch 5 times, most recently from 23d0439 to 1b18054 Compare March 18, 2024 11:30
@xukai92
Copy link
Member

xukai92 commented Mar 19, 2024

seems there are more changes than this PR aims for.
can you cheery pick those relevant ones?

@xukai92 xukai92 added this to the March 21 Musts milestone Mar 19, 2024
@leseb
Copy link
Contributor Author

leseb commented Mar 21, 2024

seems there are more changes than this PR aims for. can you cheery pick those relevant ones?

This is intended, can we merge #613 first?

@xukai92
Copy link
Member

xukai92 commented Mar 21, 2024

can you resolve the conflicts in #613?

@xukai92
Copy link
Member

xukai92 commented Mar 22, 2024

#613 is in now but the merge conflicts here are a bit more complex.
in particular, it seems to be doing both necessary changes for this PR as well as some refactoring on PIDs.
i suggest we keep that refactoring for another PR if possible

@leseb leseb force-pushed the gentle-chat-error-on-server-shutdown branch 4 times, most recently from 9b15323 to f693b66 Compare March 22, 2024 09:28
@leseb
Copy link
Contributor Author

leseb commented Mar 22, 2024

#613 is in now but the merge conflicts here are a bit more complex. in particular, it seems to be doing both necessary changes for this PR as well as some refactoring on PIDs. i suggest we keep that refactoring for another PR if possible

I resolved the conflicts and removed the refactoring.

@leseb leseb force-pushed the gentle-chat-error-on-server-shutdown branch 4 times, most recently from c467301 to fa5fdfb Compare March 22, 2024 10:37
@leseb leseb requested a review from abhi1092 as a code owner March 22, 2024 10:53
@leseb leseb force-pushed the gentle-chat-error-on-server-shutdown branch 2 times, most recently from c583772 to a819b57 Compare March 22, 2024 11:03
@leseb leseb force-pushed the gentle-chat-error-on-server-shutdown branch 4 times, most recently from 3cd18dd to 5e26c14 Compare March 22, 2024 13:26
The chat was abruptly failing with the following stack trace if the chat
is answering and the server crashes during that time:

```
lab chat

╭──────────────────────────────────────────────────────────────────── system ────────────────────────────────────────────────────────────────────╮
│ Welcome to Chat CLI w/ MERLINITE-7B-Q4_K_M (type /h for help)                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
>>>                                                                                                                                   [S][default]
>>> hello                                                                                                                             [S][default]
╭───────────────────────────────────────────────────────────── merlinite-7b-Q4_K_M ──────────────────────────────────────────────────────────────╮
│ Hello! I'm here to                                                                                                                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── elapsed 1.031 seconds ─╯
Traceback (most recent call last):
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exceptions
    yield
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpx/_transports/default.py", line 113, in __iter__
    for part in self._httpcore_stream:
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 367, in __iter__
    raise exc from None
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 363, in __iter__
    for part in self._stream:
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpcore/_sync/http11.py", line 349, in __iter__
    raise exc
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpcore/_sync/http11.py", line 341, in __iter__
    for chunk in self._connection._receive_response_body(**kwargs):
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpcore/_sync/http11.py", line 210, in _receive_response_body
    event = self._receive_event(timeout=timeout)
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpcore/_sync/http11.py", line 220, in _receive_event
    with map_exceptions({h11.RemoteProtocolError: RemoteProtocolError}):
  File "/usr/lib64/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/home/leseb/cli/test_run_2Fv9yrYE/venv/lib64/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.RemoteProtocolError: peer closed connection without sending complete message body (incomplete chunked read)
```

Now we handle this more elagantly and print before exiting:

```
lab chat
╭──────────────────────────────────────────────────────────────────── system ────────────────────────────────────────────────────────────────────╮
│ Welcome to Chat CLI w/ MERLINITE-7B-Q4_K_M (type /h for help)                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
>>> hello                                                                                                                             [S][default]
Connection to the server was closed
Executing chat failed with: API issue found while executing chat: Connection to the server was closed
```

Signed-off-by: Sébastien Han <[email protected]>
Copy link
Member

@xukai92 xukai92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks very neat now! thanks!

@xukai92 xukai92 merged commit 59af182 into instructlab:main Mar 22, 2024
@leseb leseb deleted the gentle-chat-error-on-server-shutdown branch March 22, 2024 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants