Skip to content

Socket drain after a kill never ends while a child process keeps writing #76867

Open

Description

@seanghaeli

cleanup_sockets_after_kill() in the task SDK supervisor reads each log socket until it closes. If the killed process started a child that inherited its stdout and keeps writing, the socket never closes and the drain never ends. On main this hits the Dag processor: when a Dag file's parse starts such a child and the parse times out, the processor stops parsing for good, with a stale heartbeat and 100% CPU.

Shutting down the read side of the sockets before draining fixes it, so the drain reads only what is already queued.

This also blocks a change to the triggerer from #76527: on stop, drain the trigger runner's sockets before uploading the watcher log files. Without that drain the runner's last lines are lost, because they are still in the socket when the files are uploaded (as on main). That change was taken out of #76527 because it hangs on this bug.

  • Shut down the read side before cleanup_sockets_after_kill() drains, with a test for a child that keeps writing
  • Drain the trigger runner's sockets on stop before uploading watcher log files (the change taken out of Give each asset watcher its own log file on the triggerer #76527), with a test that the last lines reach the file

Activity

  1. schizophrenicmaniac commented on Nov 10, 2026

    @schizophrenicmaniac
    Contributor

    Hi, I'd like to work on this. I'd shut down the read side of the log sockets in cleanup_sockets_after_kill() before the drain loop, so it only reads what's already queued, and add a supervisor test with a socketpair whose writer never stops.

  2. seanghaeli commented on Nov 10, 2026

    @seanghaeli
    ContributorAuthor

    Sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions