Skip to content

Conversation

@SteffenDE
Copy link
Contributor

When a process that traps exits used ExUnit's log capture functionality, it would receive stray exits from the Tasks started inside it that could lead to issues if not handled. We fix this by disabling exit trapping while awaiting the tasks in the CaptureServer's log handler.

When a process that traps exits used ExUnit's log capture functionality,
it would receive stray exits from the Tasks started inside it that could
lead to issues if not handled. We fix this by disabling exit trapping
while awaiting the tasks in the CaptureServer's log handler.
## :logger handler callback.

def log(event, _config) do
trap_exits = Process.flag(:trap_exit, false)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should toggle this because if a linked process exits, then it will make this process crash, while the process wants to trap exits.

I believe the best answer here is to store the tasks before calling Task.await_many(:infinity) and then do a traversal that discards the trapped message if trapping exits.

@josevalim josevalim merged commit b08eea7 into elixir-lang:main Mar 19, 2025
10 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

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