Skip to content

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

Merged
mhanberg merged 1 commit intoelixir-lang:mainfrom
QuinnWilton:fix/expert-unchecked-start-child
Feb 23, 2026
Merged

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

Conversation

@QuinnWilton
Copy link
Contributor

@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.

Copy link
Collaborator

@doorgan doorgan left a comment

Choose a reason for hiding this comment

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

Thank you! 💜

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.
@doorgan doorgan force-pushed the fix/expert-unchecked-start-child branch from 54171af to 2056248 Compare February 23, 2026 12:13
@mhanberg mhanberg merged commit de979ce into elixir-lang:main Feb 23, 2026
37 checks passed
mhanberg pushed a commit that referenced this pull request Feb 24, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.1.0-rc.2](v0.1.0-rc.1...v0.1.0-rc.2)
(2026-02-24)


### Features

* add `instance_id` metadata to logs
([#380](#380))
([5c209be](5c209be))


### Bug Fixes

* ensure `MIX_BUILD_PATH` is set for child processes
([#436](#436))
([3178302](3178302))
* **expert:** check start_child return in initialized handler
([#371](#371))
([de979ce](de979ce))
* forward logs through window log handler
([#418](#418))
([c608dc8](c608dc8)),
closes [#382](#382)
* support multiple elixir versions on multiroot projects
([#413](#413))
([dee595d](dee595d))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

3 participants