cluster: registerEntity does not reopen the storage read, so messages read before registration wait for entityMessagePollInterval
Maintainer thường phản hồi trong vòng 1 ngày
Một pull request liên quan đã được merge.
- #9732 của @effect-bot — đã merge
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- distributed-systems
Hướng nghiên cứu
Start in packages/effect/src/cluster/Sharding.ts at the registerEntity logic around lines 1928-1937, then trace how storageReadLatch is opened by the poll fiber and how reads reset addresses for unregistered entity types around lines 860-864. Reproduce with persisted messages and no new client message; done means registration triggers an immediate storage reread and the pending handler runs without waiting for entityMessagePollInterval.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happens
At boot, Sharding starts reading persisted messages as soon as it is built. An entity can only register after that, because registerEntity needs Sharding. When a read finds a message for an entity type that is not registered yet, Sharding resets the address and drops the message from that read ("reset address in the case that the entity is slow to register").
registerEntity then sets the entity manager inside withStorageReadLock, but it does not open storageReadLatch. With no new client message, nothing opens the latch until the poll fiber does, after entityMessagePollInterval (10 s by default). So every persisted message for that entity waits up to 10 s after a restart.
Where (packages/effect/src/cluster/Sharding.ts on main; same shape in the published 4.0.5)
- the read skips an unregistered type: lines 860-864 (
MutableHashSet.add(resetAddresses, address)); - with no client message and no full batch, only the poll fiber opens the latch: lines 1071-1076;
registerEntitysets the manager and opens only the per-type latch: lines 1928-1937.
Reproduction
- A
SqlMessageStorage-backedSingleRunnerwith a persisted entity message whose handler has not run (for example, the process was killed mid-handler). - Restart. Build the runner, then register the entity in a later layer.
- Send no new message. The handler runs about
entityMessagePollIntervalafter boot, not at registration.
In our app (gent), a resumed turn took 10.26 s with the default interval and 0.24 s after we call sharding.pollStorage once after registerEntity. With the interval set to one hour, the message did not run within a 10 s test window.
Suggested fix
Open storageReadLatch after entityManagers.set(...) in registerEntity (when the shard set is already acquired), so messages reset during the registration window are read again at once.
Workaround
Call Sharding.pollStorage after each registerEntity at the composition root.
- Ngôn ngữ chính
- TypeScript
- Star
- 16.7k
- Fork
- 808
- Merge trung bình
- 11 giờ 11 phút
- Pull request đã merge (30 ngày)
- 840
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Effect-TS/effect
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
@effect/ai-anthropic: text_editor_20250728 insert decodes `new_str`, but the API sends `insert_text`Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[email protected]: crypto/KeyFormat declarations require the global JsonWebKey, breaking Node-only type-checksCó thể đã có người làm @effect-bot đã nhận hôm nay. Đang mở
Effect-TS/effect#10115 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sql-pg: send several statements in one extended-query Sync (transaction-local context without extra round trips)Có thể đã có người làm @effect-bot đã nhận hôm nay. Đang mở
Effect-TS/effect#10113 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Effect-TS/effect
Issue tương tự
-
Parallel reticle_verify opens per-flow leases without the source lease's ignoreHTTPSErrorsCó thể đã có người làm @as992949791 đã nhận hôm nay. Đang mởgood first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
reticlehq/reticle#2033 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:quality p3-medium ready-for-agent type:docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
fderuiter/deruiter.dev#3589 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
manfredsteyer/angular-oauth2-oidc#1514 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
marmelab/react-admin#11431 ·
Maintainer thường phản hồi trong vòng 1 ngày