Skip to content

windows.process_alive: compare full hostid and check thread != 0 - #10651

Open
underiya-ai wants to merge 1 commit into
borgbackup:masterfrom
underiya-ai:fix-windows-process-alive-hostid
Open

underiya-ai wants to merge 1 commit into
borgbackup:masterfrom
underiya-ai:fix-windows-process-alive-hostid

Conversation

@underiya-ai

Copy link
Copy Markdown
Contributor

What does this PR fix?

Previously, platform.windows.process_alive() only compared host.split('@')[0].lower() against platform.node().lower() and ignored thread. However, locks store the full get_hostid() (f"{get_fqdn()}@{uuid.getnode()}" or BORG_HOST_ID):

  • On domain-joined machines or networks with a DHCP DNS suffix, get_fqdn() includes the domain suffix while platform.node() does not, causing local locks to be treated as remote.
  • Conversely, two distinct machines sharing the same hostname (platform.node()) but having different uuid.getnode() values were treated as the same host, risking false stale-lock detection.

Solution

  • Align platform.windows.process_alive() with platform.posix.process_alive() by comparing the full host != get_hostid() and checking thread != 0 before querying the local PID.
  • Remove the now-unused platform import from src/borg/platform/windows.pyx.
  • Update existing tests in src/borg/testsuite/platform/windows_test.py to use get_hostid() and add tests for mismatched hostid and non-zero thread.

@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.39%. Comparing base (06e0482) to head (9dcdd67).
⚠️ Report is 2 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10651      +/-   ##
==========================================
- Coverage   89.47%   89.39%   -0.08%     
==========================================
  Files         105      105              
  Lines       20343    20343              
  Branches     3199     3199              
==========================================
- Hits        18201    18185      -16     
- Misses       1489     1502      +13     
- Partials      653      656       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

This branch has not been deployed

No deployments
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