Skip to content

Conversation

@numso
Copy link
Contributor

@numso numso commented Sep 5, 2025

Fix for elixir-lang/expert#116

After processing a request, we attach it to lsp.tasks by its ID. This ID is parsed within a separate Task and then sent back to the main process and received. There was at least one code path where we forgot to call send(me, {:request_id, id}) to send that ID back. This would cause the process to hang while we attempted to receive a message that would never come.

This PR assumes that every request will have an "id" key and pulls it off before starting the Task. That way we don't need to store it in the process dictionary, nor do we need to send/receive it between processes. I think that makes this code a little safer and more understandable. But if I'm missing something and you'd like this solved a different way please let me know!

@numso numso changed the title ensure id always exists while handling requests fix: ensure id always exists while handling requests Sep 5, 2025
@mhanberg
Copy link
Collaborator

mhanberg commented Sep 5, 2025

Thanks for the PR!

It's okay if maybe it's too difficult, but do you think its possible to add a test for this case?

@numso
Copy link
Contributor Author

numso commented Sep 6, 2025

Alright, I added a test specifically for the error case I was running into and verified that the test fails before this code change is applied. If you think other tests would be helpful let me know and I'm happy to keep going.

@mhanberg mhanberg merged commit 94896de into elixir-tools:main Sep 6, 2025
8 checks passed
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