Skip to content

Replication places subscriptions and record-lock ownership on isolated application workers #974

Closed

Description

@kriszyp

Problem

Replication subscriptions and record-lock ownership can be placed on an isolated application's dedicated worker.

Isolated-application workers (HarperFast/harper#2524, shipped in 5.3.0) are started with name: THREAD_TYPES.HTTP (core server/threads/socketRouter.ts:276). Replication is a trusted built-in, so placedOnThisThread loads it on every worker, isolated ones included (core components/componentLoader.ts:178-179). harper-pro picks placement targets with workers.filter((worker) => worker.name === 'http') in four places, none of which exclude worker.application:

  • replication/subscriptionManager.ts:1427 (re-drive / rebinding)
  • replication/subscriptionManager.ts:1699 (connectToNextWorker → placeSubscription)
  • replication/subscriptionManager.ts:1798 (reconcileWorkers)
  • replication/recordLockTransport.ts:962 (httpWorkers() for lock ownership)

Impact

  • Replication apply, and the sending on that worker's inbound sockets, runs on the event loop the operator dedicated to one application. This defeats the isolation the operator configured.
  • Restarting that application's worker (scoped restart) drops the replication connections and lock ownership it holds. Recovery then goes through the worker-exit path and reconnect for an unrelated cause.

Fix

Exclude workers with worker.application set from replication placement. Ideally do it through one shared selector, which is also the seam #435's replication pool needs.

🤖 Claude Opus 5.5 on behalf of Kris.

Activity

  1. modified the milestones: v5.3, v5.4 on Oct 5, 2026
  2. added theissue type on Oct 5, 2026
  3. self-assigned this
    on Oct 5, 2026
  4. kriszyp commented on Oct 13, 2026

    @kriszyp
    MemberAuthor

    Fixed by #979 (Keep replication subscriptions and record-lock ownership off isolated-application workers), merged 2026-10-06. Closing; the merged PR referenced this issue without a closing keyword.

    — Claude Opus 5.5 (triage pass)

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

Priority

P2

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions