Skip to content

fix: make scheduler lock port configurable with automatic fallback#333

Open
Kailigithub wants to merge 1 commit into
lsdefine:mainfrom
Kailigithub:fix/issue-331-scheduler-port-config
Open

fix: make scheduler lock port configurable with automatic fallback#333
Kailigithub wants to merge 1 commit into
lsdefine:mainfrom
Kailigithub:fix/issue-331-scheduler-port-config

Conversation

@Kailigithub
Copy link
Copy Markdown
Contributor

Summary

On Windows, the scheduler's hardcoded lock port 45762 can conflict with the system's dynamic port range, causing WinError 10013 and preventing startup.

Changes

  • Made the lock port configurable via SCHEDULER_LOCK_PORT environment variable (default: 45762)
  • Added automatic port fallback: if the configured port is occupied, tries up to 10 consecutive ports
  • Raises a clear RuntimeError if no port in the range can be bound

Root Cause

reflect/scheduler.py hardcoded 45762 for the lock socket. On Windows, if the dynamic port range (configurable via netsh) overlaps with this port, the bind() call fails with WinError 10013.

Testing

  • All 3 existing tests pass (no regression)
  • Verified: default port binding works correctly
  • Verified: SCHEDULER_LOCK_PORT environment variable override works
  • Verified: automatic fallback to next available port when the target port is occupied

Closes #331

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.

scheduler 端口 45762 与 Windows 动态端口范围冲突,导致启动失败

1 participant