XWIKI-24800: The WYSIWYG editor sometimes doesn't join the realtime collaboration session - #6301
Merged
Conversation
…ollaboration session * Wait for the CKEditor editing mode to be set before deciding whether the realtime collaboration session can be joined. The editing mode is loaded after the plugins are initialized, so when the realtime bootstrap won the race the editor mode was still unset and the check meant to detect the Source mode matched, making the editor silently skip joining the realtime session. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
vmassol
added a commit
that referenced
this pull request
Sep 3, 2026
…ollaboration session (#6301) (#6302) * Wait for the CKEditor editing mode to be set before deciding whether the realtime collaboration session can be joined. The editing mode is loaded after the plugins are initialized, so when the realtime bootstrap won the race the editor mode was still unset and the check meant to detect the Source mode matched, making the editor silently skip joining the realtime session. (cherry picked from commit fbf84d5) Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Jira URL
https://jira.xwiki.org/browse/XWIKI-24800
This replaces #6298, which was opened on XWIKI-24287 — the flickering-test issue, in the
Development Issues onlycomponent — before we had a dedicated issue for the product bug.@mflorea reviewed and approved that PR; the code here is identical, only the issue key and the
description changed. XWIKI-24287 is now closed as
Solved ByXWIKI-24800.Changes
Description
session can be joined.
CKEDITOR.plugins.add('xwiki-realtime').init()runs atpluginsLoaded, buteditor.modeis onlyassigned much later, from within
CKEDITOR.editor.prototype.setMode(), once the mode creator(i.e. the WYSIWYG iframe) has finished loading. The initial join did:
The guard is meant to detect the Source mode, but it also matches "the editing mode is not set yet".
So whenever
Loader.bootstrap()(two REST calls) completed before the editing mode was loaded, theeditor silently gave up on joining the realtime session: no exception, no notification,
realtimeSupported === true, and none of the mode change handlers registered afterwards can recoverbecause there is no Source -> WYSIWYG switch to react to.
Clarifications
session", f582505), first released in 18.1.0 — hence the Affects Version on XWIKI-24800 and
the backport branches below. Before that commit the initial join had no mode check, so there was no
silent skip.
recreated (e.g. after a document syntax change), because the RequireJS modules and the Netflux
WebSocket are already warm and
Loader.bootstrap()then only costs two REST round trips, whilethe new editor still has to load its iframe.
RealtimeWYSIWYGEditorIT#syntaxChange:assertTrue(firstEditPage.getToolbar().isCollaborating())returningfalseright after thesyntax conversion (e.g.
master build 1361);
RealtimeWYSIWYGEditPage.gotoPage()timing out inRealtimeEditToolbar#waitUntilConnected()onthe initial page load (master build 1350).
editor with the plain
Save & View / Save / Preview / Cancelbar and "Allow RealtimeCollaboration" unchecked (the realtime toolbar was destroyed with the previous editor and never
recreated), while the
.flvrecording shows the greenSyntax convertedandWYSIWYG editor updatednotifications and no error. The browser console dump captured for another occurrence endsat
Aborting the realtime session!with an emptyREALTIME_DEBUG.logsafterwards and noSEVERE/WARNINGentry, i.e. a silent early return rather than a thrown error.whenEditingModeIsSet()also resolves ondestroy, so the promise passed todelayInstanceReady()can never hang if the editor is destroyed before its mode is loaded.isCollaborating()usesfindElements(), which already waits for the implicittimeout, so the assertion is fine once the session is actually joined.
Screenshots & Video
Failure screenshot archived by CI for master build 1361, attached to XWIKI-24287 (the reloaded
editor is no longer in a realtime session — note the standard
Save & View / Save / Preview / Cancelbutton bar and the unchecked "Allow Realtime Collaboration" checkbox):
The VNC recording of the same failure is attached too:
https://jira.xwiki.org/secure/attachment/45330/syntaxChange-failure-master-1361.flv — around
01:24:22it shows the realtime toolbar ("Done" + save status) being replaced by the standard buttonbar while the green
Syntax convertedandWYSIWYG editor updatednotifications are displayed, withno error notification at any point.
Executed Tests
All realtime Docker ITs, on this change (requested by @mflorea when reviewing #6298) — Tomcat 11
containerised + PostgreSQL + Firefox, with
xwiki.test.ui.offline=trueso that the extensioninstaller could only resolve the locally built CKEditor webjar:
Module build with all checks on (Checkstyle, license, Revapi, Spoon):
Earlier, on #6298,
syntaxChangealone was also run as a@RepeatedTest(10)on both browsers(10/10 pass on Firefox, 10/10 on Chrome).
Since the race is rare (about 2 CI failures in the last 20 master builds of the environment-tests
job), it was also reproduced deterministically by temporarily wrapping
editor.setMode()in theplugin to delay the initial mode load by 3 seconds, so that the realtime bootstrap always wins the
race:
syntaxChangefails every time, andRealtime debug info: {"logs":[]}confirms the session was never joined;syntaxChangepasses (3/3).That temporary instrumentation is not part of this PR.
Expected merging strategy
stable-18.7.xandstable-18.4.x— both contain f582505 and aretherefore affected.
stable-17.10.xandstable-16.10.xpredate it and are not affected.🤖 Generated with Claude Code