Repository navigation
fix(runtime): keep clone-only message reads read-only, and see an uncloneable brand created mid-clone - #2064
Conversation
…loneable brand created mid-clone A clone-only message is read concurrently by every BroadcastChannel receiver and every getEnvironmentData call, and deserializing it cleared its transfer vectors, a write. Only the single receiver of a message with transferables writes them now. The serializer cached the uncloneable brand when it was created, so the first markAsUncloneable call in an isolate, made by a getter in the graph being written, went unseen and the marked object was cloned. It now picks the brand up once it exists.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe change updates structured serialization to detect an uncloneable brand created while a getter runs during cloning, and to apply single-consumer handling and transferable-storage cleanup only when transferables are present. It adds a worker regression test for the clone error. ChangesStructured serialization
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to No merge-blocking issue is established; the change is ready to merge after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit watched the getter run, Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
An object marked with
markAsUncloneablefrom a getter, during the clone that reaches it, is cloned instead of throwingDataCloneErrorwhen that is the firstmarkAsUncloneablecall in the isolate. The serializer reads the brand once, when it is constructed, and at that point the brand does not exist yet. It now picks the brand up oncemarkAsUncloneablecreates it.Separately,
SerializedValue::Deserializecleared its transfer vectors on every read. A clone-only message is read by every BroadcastChannel receiver, and everygetEnvironmentDatacall, with no lock, so those clears were concurrent writes to shared state, against what the comment on theconsumed_flag intends. Only the single receiver of a message with transferables writes them now.Stacked on #2043; the same fix for iOS is NativeScript/ios#490. The new
markAsUncloneablespec fails on that branch and passes here, and the full device suite passes. The deserialization race has no deterministic spec.Summary by CodeRabbit
DataCloneErrorwhen it encounters an object marked as uncloneable during serialization.