Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

[Bug] proxy_pool.rebindAccounts rebinds accounts serially behind blocking AcquireAccount, causing head-of-line blocking when a proxy dies #35

Closed
Mag1cFall/AIStudio2API
#292

Description

@photobrand

发生了什么 / What happened

Summary

When a proxy in PROXY_POOL becomes unavailable, runtimeAdmin.rebindAccounts (internal/app/proxy_pool.go:94-120) rebinds all affected accounts sequentially inside a single goroutine, calling blocking admin.pool.AcquireAccount(admin.lifecycle, accountID) on each account one by one.

Failure Scenario

  1. 30 accounts are bound to proxy_a.
  2. proxy_a dies while account_1 has an active request stuck waiting on TCP/response timeout (up to REQUEST_TIMEOUT = 30m).
  3. reportProxyFailure or probeProxies calls rebindAccounts([account_1, account_2, ..., account_30]).
  4. rebindAccount(admin.lifecycle, "account_1") blocks inside AcquireAccount waiting for account_1's active lease to finish.
  5. account_2 through account_30 are completely idle, yet their workers and HTTP clients stay bound to the dead proxy_a for up to 30 minutes until account_1 finally unblocks.

Root Cause Pointer

internal/app/proxy_pool.go:94-120:

func (admin *runtimeAdmin) rebindAccounts(accountIDs []string) {
	if len(accountIDs) == 0 {
		return
	}
	go func() {
		for _, accountID := range accountIDs {
			if err := admin.rebindAccount(admin.lifecycle, accountID); err != nil && admin.lifecycle.Err() == nil {
				admin.requests.log(accountID, "WARN", "代理改绑失败", "error", err)
			}
		}
	}()
}

Suggested Fix

Rebind affected accounts concurrently (e.g., bounded worker pool or one goroutine per account, since AcquireAccount is already per-account) so one busy/stalled account on a dead proxy never delays rebinding all other idle accounts.

版本 / Version

v0.3.13

Activity

  1. Mag1cFall commented on Nov 22, 2026

    @Mag1cFall
    Owner

    Fixed in v0.3.14, proxy failover now rebinds accounts concurrently so idle accounts move over right away instead of waiting behind busy ones.

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