Skip to content

Conversation

Erarndt
Copy link
Contributor

@Erarndt Erarndt commented Sep 23, 2025

Fixes #

Context

Currently, the dedicated thread that handles processing the packet queue doesn't exit properly when build finishes. The threads are idle, but repeated builds create a new thread each time and they accumulate during the session:

image

The check for IsExitPacket() is slightly misleading since it checks for more than just the completion of the build

        private static bool IsExitPacket(INodePacket packet)
        {
            return packet is NodeBuildComplete buildCompletePacket && !buildCompletePacket.PrepareForReuse;
        }

By explicitly checking for the NodeBuildComplete packet, we can exit the processing loop and let the thread get cleaned up. Additionally, I named the dedicated thread to help identify issues like this in the future.

Changes Made

Testing

Notes

@Copilot Copilot AI review requested due to automatic review settings September 23, 2025 17:31
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a thread management issue where DrainPacketQueue threads were not being properly terminated when builds complete, causing thread accumulation during repeated builds. The fix ensures the dedicated thread exits when it receives a NodeBuildComplete packet.

Key changes:

  • Added explicit thread termination logic for NodeBuildComplete packets
  • Added thread naming for better debugging visibility

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.

1 participant