Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sanity): fix race condition introduced by #8120 #8211

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

bjoerge
Copy link
Member

@bjoerge bjoerge commented Jan 8, 2025

Description

#8120 introduced a regression that would occationally cause the document to be stuck at loading. Huge thanks @pedrobonamin for catching this! I believe this issue appeared because the _keepalive stream would start start pulling events from the pair listener immediately, but callers of memoizedPair will typically start subscribing to the draft.events and published.events streams a little later, and when they did, they sometimes wouldn’t get the listener events, because they have already been consumed by _keepalive.

This fixes the issue by partially reverting the PR to the way it was before #8120. Both the issue fixed by #8120 and the initial loading issues should be fixed by this.

What to review

Testing

Manual testing for now

Notes for release

n/a – the regression in #8120 didn't get released before this was discovered.

Copy link

vercel bot commented Jan 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 8, 2025 11:12am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 8, 2025 11:12am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 8, 2025 11:12am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Jan 8, 2025 11:12am
test-next-studio ⬜️ Ignored (Inspect) Jan 8, 2025 11:12am

Copy link
Contributor

github-actions bot commented Jan 8, 2025

No changes to documentation

@bjoerge bjoerge marked this pull request as ready for review January 8, 2025 10:24
@bjoerge bjoerge requested a review from a team as a code owner January 8, 2025 10:24
@bjoerge bjoerge requested review from RitaDias and pedrobonamin and removed request for a team January 8, 2025 10:24
Copy link
Contributor

github-actions bot commented Jan 8, 2025

Component Testing Report Updated Jan 8, 2025 11:15 AM (UTC)

✅ All Tests Passed -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 6s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 12s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 38s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 50s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 25s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 14s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 1m 7s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 27s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 39s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 12s 3 9 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 1m 43s 21 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 0s 0 3 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 0s 0 3 0

Copy link
Contributor

github-actions bot commented Jan 8, 2025

⚡️ Editor Performance Report

Updated Wed, 08 Jan 2025 11:17:11 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 20.6 efps (49ms) 24.4 efps (41ms) -8ms (-15.5%)
article (body) 53.2 efps (19ms) 50.4 efps (20ms) +1ms (+5.6%)
article (string inside object) 24.4 efps (41ms) 27.0 efps (37ms) -4ms (-9.8%)
article (string inside array) 21.5 efps (47ms) 23.3 efps (43ms) -4ms (-7.5%)
recipe (name) 45.5 efps (22ms) 54.1 efps (19ms) -4ms (-15.9%)
recipe (description) 50.0 efps (20ms) 60.6 efps (17ms) -4ms (-17.5%)
recipe (instructions) 99.9+ efps (6ms) 99.9+ efps (6ms) +0ms (-/-%)
synthetic (title) 18.2 efps (55ms) 18.9 efps (53ms) -2ms (-3.6%)
synthetic (string inside object) 18.5 efps (54ms) 19.0 efps (53ms) -2ms (-2.8%)

efps — editor "frames per second". The number of updates assumed to be possible within a second.

Derived from input latency. efps = 1000 / input_latency

Detailed information

🏠 Reference result

The performance result of sanity@latest

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 49ms 59ms 81ms 503ms 1058ms 11.7s
article (body) 19ms 22ms 35ms 96ms 99ms 5.3s
article (string inside object) 41ms 44ms 50ms 183ms 212ms 7.2s
article (string inside array) 47ms 50ms 58ms 194ms 446ms 7.6s
recipe (name) 22ms 23ms 28ms 53ms 0ms 7.5s
recipe (description) 20ms 21ms 24ms 41ms 0ms 4.7s
recipe (instructions) 6ms 7ms 8ms 18ms 0ms 3.1s
synthetic (title) 55ms 58ms 63ms 310ms 1067ms 13.3s
synthetic (string inside object) 54ms 57ms 70ms 437ms 1320ms 8.6s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 41ms 59ms 67ms 373ms 729ms 10.6s
article (body) 20ms 22ms 30ms 115ms 131ms 6.0s
article (string inside object) 37ms 39ms 45ms 273ms 156ms 6.7s
article (string inside array) 43ms 45ms 49ms 155ms 172ms 6.8s
recipe (name) 19ms 20ms 24ms 53ms 0ms 7.7s
recipe (description) 17ms 18ms 19ms 27ms 0ms 4.4s
recipe (instructions) 6ms 7ms 8ms 19ms 0ms 3.1s
synthetic (title) 53ms 54ms 57ms 91ms 317ms 12.0s
synthetic (string inside object) 53ms 56ms 57ms 502ms 448ms 8.4s

📚 Glossary

column definitions

  • benchmark — the name of the test, e.g. "article", followed by the label of the field being measured, e.g. "(title)".
  • latency — the time between when a key was pressed and when it was rendered. derived from a set of samples. the median (p50) is shown to show the most common latency.
  • p75 — the 75th percentile of the input latency in the test run. 75% of the sampled inputs in this benchmark were processed faster than this value. this provides insight into the upper range of typical performance.
  • p90 — the 90th percentile of the input latency in the test run. 90% of the sampled inputs were faster than this. this metric helps identify slower interactions that occurred less frequently during the benchmark.
  • p99 — the 99th percentile of the input latency in the test run. only 1% of sampled inputs were slower than this. this represents the worst-case scenarios encountered during the benchmark, useful for identifying potential performance outliers.
  • blocking time — the total time during which the main thread was blocked, preventing user input and UI updates. this metric helps identify performance bottlenecks that may cause the interface to feel unresponsive.
  • test duration — how long the test run took to complete.

Copy link
Contributor

@pedrobonamin pedrobonamin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this @bjoerge !
Tested with assist and it works.
Also tested this and it works.

🚢

@bjoerge bjoerge changed the title fix(sanity): fix race condition regression introduced by #8120 fix(sanity): fix race condition introduced by #8120 Jan 8, 2025
@bjoerge bjoerge added this pull request to the merge queue Jan 8, 2025
Merged via the queue into next with commit 27feda0 Jan 8, 2025
57 checks passed
@bjoerge bjoerge deleted the chore/fix-checkout-pair-listener-issue branch January 8, 2025 11:17
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.

2 participants