Skip to content

fix: close daemon health probe socket#492

Open
SUJALMU2004 wants to merge 1 commit into
browser-use:mainfrom
SUJALMU2004:fix-ensure-daemon-closes-socket
Open

fix: close daemon health probe socket#492
SUJALMU2004 wants to merge 1 commit into
browser-use:mainfrom
SUJALMU2004:fix-ensure-daemon-closes-socket

Conversation

@SUJALMU2004

@SUJALMU2004 SUJALMU2004 commented Jul 7, 2026

Copy link
Copy Markdown

Summary

  • close the IPC socket opened by ensure_daemon() during the warm daemon health probe
  • add a regression test for the healthy daemon early-return path

Why

ensure_daemon() probes a live daemon with Target.getTargets before returning. On the healthy path it returned immediately without closing the socket, which can leak descriptors in long-lived agent processes that call ensure_daemon() repeatedly.

Tests

  • python -m pytest -q tests\unit\test_admin.py::test_ensure_daemon_closes_probe_socket_when_daemon_is_healthy
  • python -m compileall -q src tests
  • python -m pytest -q tests\unit\test_admin.py -k "not preserves_snap_bin"

Summary by cubic

Fixes a file descriptor leak in the daemon health probe and adds a regression test for the healthy path.

  • Bug Fixes
    • Close the probe socket in a finally block and ignore close errors to avoid descriptor leaks on repeated calls.
    • Unit test verifies the healthy path returns early, does not restart the daemon, and closes the socket.

Written for commit 4157162. Summary will update on new commits.

Review in cubic

@SUJALMU2004 SUJALMU2004 marked this pull request as ready for review July 7, 2026 09:32

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 2 files

Re-trigger cubic

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