Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using tfs wake throwing errors about Invalid HTTP header. #71

Open
PFAhard opened this issue Dec 20, 2023 · 1 comment
Open

When using tfs wake throwing errors about Invalid HTTP header. #71

PFAhard opened this issue Dec 20, 2023 · 1 comment

Comments

@PFAhard
Copy link

PFAhard commented Dec 20, 2023

When using wake with tfs, it throwing errors about Invalid HTTP header, actually an empty message. Which is not nice.

ERROR    2023-12-20 08:30:38,233 wake.lsp.server: Invalid HTTP header:                                                                                                                              server.py:312
         Traceback (most recent call last):
           File "<APPDATA>\Local\Programs\Python\Python312\Lib\site-packages\wake\lsp\server.py", line 303, in _task_done_callback
             task.result()
           File "<APPDATA>\Local\Programs\Python\Python312\Lib\site-packages\wake\lsp\server.py", line 357, in _main_task
             message = await self.__protocol.receive()
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           File "<APPDATA>\Local\Programs\Python\Python312\Lib\site-packages\wake\lsp\rpc_protocol.py", line 54, in receive
             raw_message = await self._read_message()
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
           File "<APPDATA>\Local\Programs\Python\Python312\Lib\site-packages\wake\lsp\rpc_protocol.py", line 44, in _read_message
             raise RpcProtocolError(f"Invalid HTTP header: {line}")
         wake.lsp.rpc_protocol.RpcProtocolError: Invalid HTTP header:
ERROR    2023-12-20 08:30:38,485 asyncio: Task exception was never retrieved                                                                                                                  base_events.py:1785
         future: <Task finished name='Task-6' coro=<run_server.<locals>.client_callback() done, defined at
         <APPDATA>\Local\Programs\Python\Python312\Lib\site-packages\wake\cli\lsp.py:21> exception=RpcProtocolError('Invalid HTTP header: ')>
         Traceback (most recent call last):
           File "<APPDATA>\Local\Programs\Python\Python312\Lib\site-packages\wake\cli\lsp.py", line 26, in client_callback
             await lsp_server.run()
           File "<APPDATA>\Local\Programs\Python\Python312\Lib\site-packages\wake\lsp\server.py", line 347, in run
             await task
         wake.lsp.rpc_protocol.RpcProtocolError: Invalid HTTP header:
@michprev
Copy link
Member

Hi @PFAhard, while it may not look nice, this exception is harmless, and from the perspective of the LSP server, it is correct.

It is caused by the following logic in the extension:
https://github.com/Ackee-Blockchain/tools-for-solidity-vscode/blob/60b36223b8fbb03f213e59b904507d6c3e7f78fd/src/extension.ts#L334-L338

While waiting for the port to open, it's trying to connect to the server. As soon as the connection is established, it just disconnects. This causes the invalid HTTP header error.

The language server is designed so that an exception in a single connection with a client does not crash the whole server, and the server may still accept more connections.

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

No branches or pull requests

2 participants