Skip to content

TimeoutError: Request timed out: method=initialize, id=1 #20

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

Open
USeebi opened this issue Apr 11, 2025 · 2 comments
Open

TimeoutError: Request timed out: method=initialize, id=1 #20

USeebi opened this issue Apr 11, 2025 · 2 comments

Comments

@USeebi
Copy link

USeebi commented Apr 11, 2025

Trying to troubleshoot the error of a python wrapper from jupyter-copilot https://github.com/baolong281/jupyter-copilot/blob/main/jupyter_copilot/lsp.py. The error is coming from the function below in the wrapper.

Is there anyway I could elicit why there is no response from the server say if the server could be started manually?

node ./node_modules/@github/copilot-language-server/dist/language-server.js --stdio

    def send_request(self, method: str, params: dict) -> Any:
        """
        sends a request to the lsp and returns the response
        if a response comes then __handle_recieved_payloads will be called
        and will run the resolve or reject callback
        """
        self.request_id += 1
        self.__send_message({"id": self.request_id, "method": method, "params": params})
        result = threading.Event()
        response = {}
    
        def resolve(payload):
            response['result'] = payload
            result.set()

        def reject(payload):
            response['error'] = payload
            result.set()

        # put the callback into the map
        # when we get the response, we will call resolve or reject and the entry will be popped
        self.resolve_map[self.request_id] = resolve
        self.reject_map[self.request_id] = reject

        # 10 second timeout to prevent indefinite waiting
        # this will immediately stop blocking if the result is set by calling either resolve or reject
        result.wait(timeout=10)

        # at this point if a response has not been received then result will not be set, so we throw an error
        if not result.is_set():
            raise TimeoutError(f"Request timed out: method={method}, id={self.request_id}")

        if 'error' in response:
            raise Exception(response['error'])

        self.resolve_map.pop(self.request_id, None)
        self.reject_map.pop(self.request_id, None)
        return response['result']
@tpope
Copy link

tpope commented Apr 14, 2025

You could try checking standard error. Generally initialize should always return either a result or an error. If it's timing out, that suggests a low level issue with the underlying protocol implementation.

@USeebi
Copy link
Author

USeebi commented Apr 15, 2025

Thanks for the comments.

I did double checked the LSP server the wrapper used by testing the copilot-lsp dist with vim and using the copilot-vim's server dist with the wrapper. Vim worked in both dist but the wrapper failed in either cases.

Can I concluded the low level issue in on the client side rather than the server side or I still miss something? Is there any similar python wrapper implementation I can make reference to troubleshoot?

Thanks again!

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