Skip to content

Comments

fix(expert): check start_child return in initialized handler#371

Open
QuinnWilton wants to merge 1 commit intoelixir-lang:mainfrom
QuinnWilton:fix/expert-unchecked-start-child
Open

fix(expert): check start_child return in initialized handler#371
QuinnWilton wants to merge 1 commit intoelixir-lang:mainfrom
QuinnWilton:fix/expert-unchecked-start-child

Conversation

@QuinnWilton
Copy link

@QuinnWilton QuinnWilton commented Feb 10, 2026

This is part of a set of 4 PRs that arose out of some static analysis tooling I'm working on:

That means that these aren't crashes or issues that I've observed in practice, however based on my reading of the code, they do represent issues worth addressing.

Problem:

Project initialization tasks are spawned using Task.Supervisor.start_child/2, however the result of this call is never checked, and if the task fails to start (because the supervisor is at capacity, for example), the failure goes unnoticed, and the project remains in an uninitialized state, with no visibility into the failure.

Solution

There are two possible solutions:

  1. match against :ok, and crash the caller if the task fails to start
  2. match against the error case, and log it

Normally (1) would be a good option, however:

  • the caller is the main GenServer for the LSP, and crashing here would impact all other projects
  • the failure reasons here have nothing to do with the caller's state, and a restart would do nothing to resolve them

In light of both of those reasons, logging the failure is the only thing that makes sense.

The return value of Task.Supervisor.start_child was silently discarded.
If the supervisor is at capacity or shutting down, project
initialization would fail without any indication.

Log an error on {:error, reason} so the failure is observable.
@QuinnWilton QuinnWilton force-pushed the fix/expert-unchecked-start-child branch from 74ca6c9 to 54171af Compare February 10, 2026 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants